で実行されるjqueryコードがあります.change()
。しかし、 jquery で同じコードを実行したいのですが、うまくいき.ready()
ません。
これが私のコードです:
jQuery('.nhp-opts-select-hide-below').change(function(){
var option = jQuery('option:selected', this);
if(option.data('show').length > 0 || option.data('hide').length > 0){
jQuery(option.data('show')).each(function(){
if(jQuery(this).closest('tr').is(':hidden')){
jQuery(this).closest('tr').fadeIn('fast');
}
});
jQuery(option.data('hide')).each(function(){
if(jQuery(this).closest('tr').is(':visible')){
jQuery(this).closest('tr').fadeOut('fast');
}
});
}else{
jQuery(option.data('show')).each(function(){
if(jQuery(this).closest('tr').is(':visible')){
jQuery(this).closest('tr').fadeOut('fast');
}
});
jQuery(option.data('hide')).each(function(){
if(jQuery(this).closest('tr').is(':hidden')){
jQuery(this).closest('tr').fadeIn('fast');
}
});
}
});
上記のコードをjquery Readyで実行する方法を教えてください??