{"id":12264,"date":"2022-08-03T13:26:31","date_gmt":"2022-08-03T17:26:31","guid":{"rendered":"http:\/\/local.brightwhiz\/?post_type=snippets&p=12264"},"modified":"2022-08-03T13:26:33","modified_gmt":"2022-08-03T17:26:33","slug":"use-jquery-to-disable-and-enable-an-html-input","status":"publish","type":"snippets","link":"http:\/\/local.brightwhiz\/snippets\/use-jquery-to-disable-and-enable-an-html-input\/","title":{"rendered":"How to Use jQuery to Disable and Enable an HTML Input"},"content":{"rendered":"\n
With jQuery 1.6+ use the following syntax to disable and enable the HTML input:<\/p>\n\n\n\n
$("#inputID").prop('disabled', true); \/\/disable \n$("#inputID").prop('disabled', false); \/\/enable<\/code><\/pre>\n\n\n\nThose still on jQuery 1.5 and below use this to disable and enable the HTML input:<\/p>\n\n\n\n
$("#inputID").attr('disabled','disabled'); \/\/disable \n$("#inputID").removeAttr('disabled'); \/\/enable<\/code><\/pre>\n","protected":false},"comment_status":"open","ping_status":"closed","template":"","meta":[],"categories":[953,27,15,16],"tags":[303,328,333,350,424,433,449,591,638],"yoast_head":"\nHow to Use jQuery to Disable and Enable an HTML Input<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n