Skip to main content
CSS-Tricks
  • Articles
  • Videos
  • Almanac
  • Newsletter
  • Guides
  • DigitalOcean
  • DO Community
Search
Code Snippets → jQuery Code Snippets → Disable / Re-enable Inputs

Disable / Re-enable Inputs

Avatar of Chris Coyier
Chris Coyier on Nov 29, 2009

Disable:

$("#submit-button").attr("disabled", true);

Re-enable:

$("#submit-button").removeAttr("disabled");
Psst! Create a DigitalOcean account and get $200 in free credit for cloud-based hosting and services.

Comments

  1. Wouter van Tilburg
    Permalink to comment# June 1, 2011

    You can also use the .prop() function.

    A simple


    $("#submit-button").prop('disabled', true);
    $("#submit-button").prop('disabled', false);

    will also do then.

    Reply
  2. David
    Permalink to comment# November 19, 2012

    .prop does not work in IE

    Reply
    • RAFFI
      Permalink to comment# January 24, 2013

      Yes Its Not Workin On Internate Explorer

    • Leon Revill
      Permalink to comment# February 5, 2013

      Which version? I am using it in this tutorial jquery disable button and it is working fine in IE9, do you mean earlier versions, I didn’t know this.

      Thanks!

    • gunjan
      Permalink to comment# March 22, 2013

      yeahh…

    • shobana
      Permalink to comment# October 18, 2016

      Not working in IE 11 also

  3. Senthil
    Permalink to comment# May 11, 2015

    Use

    $(“#submit-button”).prop(“disabled”, true);

    Reply
  4. Darbez
    Permalink to comment# January 20, 2016

    $(“#submit-button”).is(‘disabled’, true);
    $(“#submit-button”).is(‘disabled’, false);

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

CSS-Tricks is powered by DigitalOcean.

Keep up to date on web dev

with our hand-crafted newsletter

DigitalOcean
  • DigitalOcean
  • DigitalOcean Community
  • About DigitalOcean
  • Legal
  • Free Credit Offer
CSS-Tricks
  • Email
  • Guest Writing
  • Book
  • Advertising
Follow
  • Mastodon
  • Twitter
  • Instagram
  • YouTube
  • CodePen
  • iTunes
  • RSS
Back to Top