UPDATE: When using the Bootstrap switch, you can use one of two functions:
$(this).bootstrapSwitch("toggleDisabled");
$(this).bootstrapSwitch("disabled",true);
, onSwitchChange bootstrapSwitch("disabled", true):
onSwitchChange:function(event, state) {
$(this).bootstrapSwitch('disabled', true);
}
"", , - , .
- , jQuery
disabled, disabled.
, true, disabled.
( /) disabled=disabled.
jQuery, attr() ( - , - ):
onSwitchChange:function(event, state) {
$(this).attr('disabled', 'disabled');
}
.. , , form.
POSTed , readonly readonly:
onSwitchChange:function(event, state) {
$(this).attr('readonly', 'readonly');
}
, disabled readonly: fooobar.com/questions/29073/...
. / checkbox. , .closest().
, :
div - div..some-class - , "some-class"#someId id - id "someId"
closest, ( )
:
// set the checkbox closest element with "bootstrapSwitch" class, to disabled
$(this).closest('.bootstrapSwitch').attr('disabled', 'disabled');
, !:)