ブートストラップの属性作業を無効にしないのはなぜですか。
-
21-12-2019 - |
質問
私は私のウェブサイトのフォーム、入力、選択をスタイル化したいです。 bootstrap http://silviomoreto.github.io/bootstrap-select/を使用しました。 "" rel="nofollow"> bootstrap-select selectと icheck チェックボックスの場合。問題は、ICHECTがBOOTSTRAP-SELECTと正しく機能しないことです。
これはJSFIDDLEテストです: http://jsfiddle.net/36xpf/
チェックボックスがチェックされているかどうかを選択するために属性を除いたjQuery .change()
:
$('#checkbox1').change(function(){
if (this.checked) {
$('.selectpicker').attr('disabled', false);
} else {
$('.selectpicker').attr('disabled', true);
}
});
.
私は何をしましたか? Bootstrap Selectでは無効な属性が機能しないのはなぜですか?
どんな助けにかかっています!ありがとうございました!
解決
通常のチェックボックスではなく、実際にサポートしているイベントをリッスンする必要があります。
$('#checkbox1').on('ifChanged', function(){
$('.selectpicker').attr('disabled', this.checked).selectpicker('refresh');
}).iCheck({
checkboxClass: 'icheckbox_flat-red',
radioClass: 'iradio_flat-red'
});
.
href="http://jsfiddle.net/36xpf/1/" REL="nofollow"> フィドル
他のヒント
$('input#checkbox1').iCheck({
checkboxClass: 'icheckbox_flat-red',
radioClass: 'iradio_flat-red'
});
$('.selectpicker').selectpicker();
$(document).on('ifChecked','#checkbox1',function(){
$('.selectpicker').prop('disabled',true);
$('.selectpicker').selectpicker('refresh');
});
$(document).on('ifUnchecked','#checkbox1',function(){
$('.selectpicker').prop('disabled',false);
$('.selectpicker').selectpicker('refresh');
});
/*standard checkbox*/
$('#checkbox2').change(function(){
if (this.checked) {
$('.standard').attr('disabled', true);
} else {
$('.standard').attr('disabled', false);
}
});
.
このJSコードを使用する
所属していません StackOverflow