I am trying to develop a JQuery script to change the state of a checkbox by setting the disabled attribute to true depending on the state of a different checkbox.
我有三个che箱——暂停使用、选择1和选择2
采用以下代码,在点击中止的检查箱后,另外两个是残疾人。 如果我不堵塞被停放的箱子,他们就会被利用(被拆除)。
我也希望用同样的逻辑上载荷。 我的法典如下:
(function( $ ) {
use strict ;
$( document ).ready(function() {
if( $( input[name="suspended"] ).is( :checked )){
console.log( "Suspended is checked" );
$( input[name="option1"] ).attr("disabled", true);
$( input[name="option2"] ).attr("disabled", true);
}
else{
console.log( "Suspended is unchecked" );
$( input[name="option1"] ).removeAttr("disabled");
$( input[name="option2"] ).removeAttr("disabled");
}
$( input[name="suspended"] ).change( function( e ){
e.preventDefault;
if ($(this).is( :checked )) {
$( input[name="option1"] ).attr("disabled", true);
$( input[name="option2"] ).attr("disabled", true);
}else {
$( input[name="option1"] ).removeAttr("disabled");
$( input[name="option2"] ).removeAttr("disabled");
}option2
} );
});
})( jQuery );
我显然已经解决了点击情况的变化,但无法说明为什么它也无意上下页。 我能够获得一个假释。 标语:在页数上显示国家,但hn箱状态。