문제

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');
    }
});
도움이 되었습니까?

해결책

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

다른 팁

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');
  }
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top