Conflicting JavaScripts

Posted on 2012-09-14
Medium Priority
Last Modified: 2012-09-14

I've got conflicting javascripts running on my site --

<script type="text/javascript">
var $ = jQuery.noConflict();
  $('label.supplierselect').click(function() {
    var cb = $('#' + $(this).attr('for'));
	if (cb.is(':checked')) {
	else {
<script type="text/javascript">
$(document).ready(function() {
	$('label').click(function() {

Open in new window

The first should only target labels with a class of supplierselect

The second should be targeting labels in a table with a class of tableodd which is in a form with an id of BrandRate.

The first works fine, until the second is added, once that happens the unselect fails...

Please advise.

Thank you
Question by:garethtnash
LVL 58

Assisted Solution

Gary earned 1000 total points
ID: 38398915
Should you not be specifying your class or target.
     $('.tableodd  label').click(function() {
LVL 60

Accepted Solution

Julian Hansen earned 1000 total points
ID: 38398949
Your second script is targeting all labels - it will include label.supplierselect as well - you need to either exclude that by using the not

$('label').not(''supplierselect').click ...

Or by adding something to distiinguish the too

$('.tableodd label').click ...

Author Closing Comment

ID: 38398970
Excellent Thank you Both

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question