Question

I'm using jquery 1.6.1.When I want to use addClass with live change, it doesn't work. please look at my example: http://jsfiddle.net/mr_seven/Mp8zc/1/

$("#qty").live('change', function() {
    if ($(this).val() == '1'){
        jQyery('#card_2').addClass('takhfif');
    } else {
        jQyery('#card_2').removeClass('takhfif');
    }
});
Was it helpful?

Solution

you have typo for selector. it should be jQuery not jQyery:

$("#qty").live('change', function() {
 if ($(this).val() == '1'){
     jQuery('#card_2').addClass('takhfif');
  } else {
     jQuery('#card_2').removeClass('takhfif');
 }});

Working Fiddle

OTHER TIPS

This should be jQuery not jQyery:

$("#qty").live('change', function() {
  if ($(this).val() == '1'){
    jQuery('#card_2').addClass('takhfif');
  } else {
     jQuery('#card_2').removeClass('takhfif');
  }
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top