Find if a textbox is disabled or not using jquery

JqueryHtml

Jquery Problem Overview


I need to find if a textbox is disabled or enabled using Jquery.

Jquery Solutions


Solution 1 - Jquery

.prop('disabled') will return a Boolean:

var isDisabled = $('textbox').prop('disabled');

Here's the fiddle: http://jsfiddle.net/unhjM/

Solution 2 - Jquery

You can find if the textbox is disabled using is method by passing :disabled selector to it. Try this.

if($('textbox').is(':disabled')){
     //textbox is disabled
}

Solution 3 - Jquery

You can use $(":disabled") to select all disabled items in the current context.

To determine whether a single item is disabled you can use $("#textbox1").is(":disabled").

Solution 4 - Jquery

You can check if a element is disabled or not with this:

if($("#slcCausaRechazo").prop('disabled') == false)
{
//your code to realice 
}

Solution 5 - Jquery

 if($("element_selector").attr('disabled') || $("element_selector").prop('disabled'))
 {
    
    // code when element is disabled
    
  }

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVaibhav JainView Question on Stackoverflow
Solution 1 - JqueryJoseph SilberView Answer on Stackoverflow
Solution 2 - JqueryShankarSangoliView Answer on Stackoverflow
Solution 3 - JquerysshowView Answer on Stackoverflow
Solution 4 - Jqueryuser4272288View Answer on Stackoverflow
Solution 5 - JqueryRajat BansalView Answer on Stackoverflow