{"id":798,"date":"2012-06-06T10:03:05","date_gmt":"2012-06-06T10:03:05","guid":{"rendered":"https:\/\/theextremewebdesigns.com\/blog\/?p=798"},"modified":"2012-06-06T10:03:05","modified_gmt":"2012-06-06T10:03:05","slug":"jquery-disable-input-use-jquery-to-disable-input-textbox","status":"publish","type":"post","link":"https:\/\/theextremewebdesigns.com\/blog\/jquery-disable-input-use-jquery-to-disable-input-textbox\/","title":{"rendered":"jQuery Disable Input Textbox Examples"},"content":{"rendered":"<p><strong><\/strong>\u00a0<em><strong>Using jQuery you can easily disable input<\/strong><\/em>. These input can be textbox, textarea, etc. Read on to find out easy it is to disable input using jQuery.<!--more--><\/p>\n<h2>Use jQuery to Disable Input Textbox<\/h2>\n<p>Let&#8217;s assume that you have an input box with the ID &#8220;first_name&#8221;. You can disable it using the following code:<\/p>\n<h3>Disable input using jQuery:<\/h3>\n<pre class=\"lang:js decode:true\">$(\"#first_name\").attr('disabled','disabled');<\/pre>\n<h3>Enable disabled input using jQuery:<\/h3>\n<pre class=\"lang:js decode:true crayon-selected\">$(\"#first_name\").removeAttr('disabled');<\/pre>\n<h3>Enable \/ Disable Input using prop() method in jQuery<\/h3>\n<p>In jQuery 1.6+, a new method ( called prop() ) has been introduced that you can use. The following is the sample code:<\/p>\n<pre class=\"lang:js decode:true\">\/\/To disable input\n$(\"#first_name\").prop('disabled', true);\n\n\/\/To enable input\n$(\"#first_name\").prop('disabled', false);<\/pre>\n<h5>Your Turn!<\/h5>\n<p>Do you know of any other ways to <strong>disable input using jQuery<\/strong>? Feel free to suggest by commenting below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0Using jQuery you can easily disable input. These input can be textbox, textarea, etc. Read on to find out easy it is to disable input using jQuery.<\/p>\n","protected":false},"author":1,"featured_media":395,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[20,13],"tags":[41],"class_list":["post-798","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery-tips-and-tricks","category-tips-and-tricks","tag-jquery-tips"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paBnQX-cS","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/798","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=798"}],"version-history":[{"count":0,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/798\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}