Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find if a textbox is disabled or not using jquery

Tags:

html

jquery

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

like image 589
Vaibhav Jain Avatar asked Jan 22 '12 19:01

Vaibhav Jain


People also ask

How check textbox is disabled or not in JavaScript?

Use the disabled property to check if an element is disabled, e.g. if (element. disabled) {} . The disabled property returns true when the element is disabled, otherwise false is returned.

How check dropdown is disabled or not in jQuery?

$('#dropDownId'). attr('disabled');

Is readonly jQuery?

Learning jQuery So use the same attribute "readonly" to find out whether textbox is readonly or not using jQuery. $(document). ready(function(){ $("#txtReadonly"). attr('readonly', true); var isReadonly = $("#txtReadonly").


1 Answers

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

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

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

like image 142
Joseph Silber Avatar answered Oct 02 '22 21:10

Joseph Silber