How to Enable/Disable Input element in JQuery
To disable input elements (checkbox, radio button, text box, button etc) in jquery, you need to set disabled attribute.
// check box
$("#check_box_id").attr("disabled", "disabled");
// radio button
$("#radio_btn_id").attr("disabled", "disabled");
// Text box
$("#text_box_id").attr("disabled", "disabled");
// button
$("#btn_id").attr("disabled", "disabled");
To Enable the input elements (checkbox, radio button, text box, button etc) , we need to remove disabled attribute. This can be done in the following way.
// check box
$("#check_box_id").removeAttr("disabled");
// radio button
$("#radio_btn_id").removeAttr("disabled");
// Text box
$("#text_box_id").removeAttr("disabled");
// button
$("#btn_id").removeAttr("disabled");
September 29, 2008 | Filed Under Javascript
Related Post
Comments
Leave a Reply