jquery - Conflicts between with click function -


i have problems on conflicting code, i've checked console errors, far nothing, have several selections notifications via jgrowl.

im using jquery 1.9.1

this first part

                $("#amconf-images-139.amconf-images-container").click(function() {         if ($('#amconf-image-84.amconf-image.amconf-image-selected').length){             var = $('input[name="qty2"]').val().replace("$", "");              var b = $('#product-price-1202_clone span.price').html().replace("$", "");               $.jgrowl("1 inch debossed selected<br />estimated cost: $" + (a*b).tofixed(2));         } else if ($('#amconf-image-86.amconf-image.amconf-image-selected').length){                   $.jgrowl("1 inch ink-injected selected<br />estimated cost: $" + (a*b).tofixed(2));              } else if ($('#amconf-image-87.amconf-image.amconf-image-selected').length){                   $.jgrowl("1 inch printed selected<br />estimated cost: $" + (a*b).tofixed(2));         }  }); 

the code above works kills second part

       $("#amconf-images-140").click(function() {         if ($('#amconf-image-114.amconf-image.amconf-image-selected').length){             $.jgrowl("black color selected");         } else if ($('#amconf-image-115.amconf-image.amconf-image-selected').length){                   $.jgrowl("brown color selected");         } else if ($('#amconf-image-116.amconf-image.amconf-image-selected').length){                   $.jgrowl("green color selected");         } else if ($('#amconf-image-117.amconf-image.amconf-image-selected').length){                   $.jgrowl("grey color selected");         } else if ($('#amconf-image-118.amconf-image.amconf-image-selected').length){                   $.jgrowl("hot pink color selected");         } else if ($('#amconf-image-119.amconf-image.amconf-image-selected').length){                   $.jgrowl("hunter green color selected");         } else if ($('#amconf-image-120.amconf-image.amconf-image-selected').length){                   $.jgrowl("lavender color selected");         } else if ($('#amconf-image-121.amconf-image.amconf-image-selected').length){                   $.jgrowl("light blue color selected");         } else if ($('#amconf-image-122.amconf-image.amconf-image-selected').length){                   $.jgrowl("light pink color selected");         } else if ($('#amconf-image-123.amconf-image.amconf-image-selected').length){                   $.jgrowl("lime green color selected");         } else if ($('#amconf-image-124.amconf-image.amconf-image-selected').length){                   $.jgrowl("maroon color selected");         } else if ($('#amconf-image-125.amconf-image.amconf-image-selected').length){                   $.jgrowl("metallic gold color selected");         } else if ($('#amconf-image-126.amconf-image.amconf-image-selected').length){                   $.jgrowl("metallic silver color selected");         } else if ($('#amconf-image-127.amconf-image.amconf-image-selected').length){                   $.jgrowl("olive green color selected");         } else if ($('#amconf-image-128.amconf-image.amconf-image-selected').length){                   $.jgrowl("orange color selected");         } else if ($('#amconf-image-129.amconf-image.amconf-image-selected').length){                   $.jgrowl("pearl blue color selected");         } else if ($('#amconf-image-130.amconf-image.amconf-image-selected').length){                   $.jgrowl("purple color selected");         } else if ($('#amconf-image-131.amconf-image.amconf-image-selected').length){                   $.jgrowl("red color selected");         } else if ($('#amconf-image-132.amconf-image.amconf-image-selected').length){                   $.jgrowl("reflex blue color selected");         } else if ($('#amconf-image-133.amconf-image.amconf-image-selected').length){                   $.jgrowl("teal color selected");         } else if ($('#amconf-image-134.amconf-image.amconf-image-selected').length){                   $.jgrowl("white color selected");         } else if ($('#amconf-image-135.amconf-image.amconf-image-selected').length){                   $.jgrowl("yellow color selected");         } else if ($('#amconf-image-136.amconf-image.amconf-image-selected').length){                   $.jgrowl("yellow gold color selected");         }       }); 

the second jquery part doesn't want show notification, divs similar? seperate divs own unique number.

any ideas?

this might started:

var amimages140 = {     "114": "black color selected",         "115": "brown color selected",         "116": "green color selected",         "117": "grey color selected",         "118": "hot pink color selected",         "119": "hunter green color selected",         "120": "lavender color selected",         "121": "light blue color selected",         "122": "light pink color selected",         "123": "lime green color selected",         "124": "maroon color selected",         "125": "metallic gold color selected",         "126": "metallic silver color selected",         "127": "olive green color selected",         "128": "orange color selected",         "129": "pearl blue color selected",         "130": "purple color selected",         "131": "red color selected",         "132": "reflex blue color selected",         "133": "teal color selected",         "134": "white color selected",         "135": "yellow color selected",         "136": "yellow gold color selected" }; 

fix scope issue:

$("#amconf-images-139.amconf-images-container").click(function () {     var = '';     var b = '';     if ($('#amconf-image-84.amconf-image.amconf-image-selected').length) {         = $('input[name="qty2"]').val().replace("$", "");         b = $('#product-price-1202_clone span.price').html().replace("$", "");         $.jgrowl("1 inch debossed selected<br />estimated cost: $" + (a * b).tofixed(2));     } else if ($('#amconf-image-86.amconf-image.amconf-image-selected').length) {         $.jgrowl("1 inch ink-injected selected<br />estimated cost: $" + (a * b).tofixed(2));     } else if ($('#amconf-image-87.amconf-image.amconf-image-selected').length) {         $.jgrowl("1 inch printed selected<br />estimated cost: $" + (a * b).tofixed(2));     } }); 

simpler method:

$("#amconf-images-140").click(function () {     var im = '';     (im in amimages140) {         if ($('#amconf-image-' + im + '.amconf-image.amconf-image-selected').length) {             $.jgrowl(amimages140[im]);         }     } }); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -