1

I'm trying to disable textbox using jquery like below but its not working

$("#docNumber").attr("disabled","disabled");

also tried beow but no luck

$("#docNumber").attr("disabled",true);

Below is code http://jsfiddle.net/sukumar/j6jZA/2/

3 Answers 3

3

This issue is on your first line:

$(document).ready(

This must be:

$(document).ready(function(){

And then finish off with:

});

See this update, works fine: http://jsfiddle.net/j6jZA/7/

Sign up to request clarification or add additional context in comments.

Comments

1

You are not using .ready correctly in your fiddle --> $(document).ready(

$(document).ready(function(){

 // disable the docNumber textbox when page is loaded
    $("#docNumber").prop("disabled",true);

});

Working demo --> http://jsfiddle.net/j6jZA/5/

Comments

1

Your fiddle is correct, your DOM ready statement is wrong. Change to:

$(document).ready(function() {
//do stuff
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.