且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

根据复选框点击隐藏/显示div。在jsFiddle中工作,但不会在我的网站上。有任何想法吗?

更新时间:2023-10-06 21:10:22

It's because your script

  $('#CCMethod').change(function(){
      if ($(this).is(':checked')) {
        $('#CCPay').fadeIn('slow');
      } else {
        $('#CCPay').fadeOut('slow');
      }                   
    });

is running before #CCMethod is declared. Wrap it in a doc-ready:

$(function() {
    ('#CCMethod').change(function(){
      if ($(this).is(':checked')) {
        $('#CCPay').fadeIn('slow');
      } else {
        $('#CCPay').fadeOut('slow');
      }                   
    });
 });

相关阅读

推荐文章