Conflicting JavaScripts

Posted on 2012-09-14
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 (':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

    Should you not be specifying your class or target.
         $('.tableodd  label').click(function() {
    LVL 50

    Accepted Solution

    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

    Excellent Thank you Both

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
    Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
    In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
    In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now