Mots clés : javascriptjqueryhtml-inputdisabled-inputjavascript
98
$("input").prop('disabled', true); $("input").prop('disabled', false);
$("input").attr('disabled','disabled');
$("input").removeAttr('disabled');
// assuming an event handler thus 'this' this.disabled = true;
85
$(document).on('event_name', '#your_id', function() { $(this).removeAttr('disabled'); });
$(document).off('event_name', '#your_id', function() { $(this).attr('disabled','disabled'); });
76
// Disable #x $( "#x" ).prop( "disabled", true ); // Enable #x $( "#x" ).prop( "disabled", false );
//To disable $('.someElement').attr('disabled', 'disabled');
//To enable $('.someElement').removeAttr('disabled'); // OR you can set attr to "" $('.someElement').attr('disabled', '');
62
$("input")[0].disabled = true;
$("input")[0].disabled = false;
52
$.prototype.enable = function () { $.each(this, function (index, el) { $(el).removeAttr('disabled'); }); } $.prototype.disable = function () { $.each(this, function (index, el) { $(el).attr('disabled', 'disabled'); }); }
$(".myInputs").enable(); $("#otherInput").disable();