1

I'm having trouble with my jQuery syntax. Could someone show me how to iterate through all controls on a form that have the readonly attribute, remove the readonly attribute, and make then disabled instead? Thank you.

2
  • How about posting what you have so far instead of asking someone to write your code for you? Commented Aug 31, 2011 at 18:39
  • You're right. I'll make sure to do so next time. Commented Aug 31, 2011 at 18:47

3 Answers 3

3
$('input[readonly="readonly"]').removeAttr("readonly").prop("disabled",true);
Sign up to request clarification or add additional context in comments.

Comments

1
 $("#formID").each('input[readonly="readonly"]', function () {                
       $(this).removeAttr("readonly");
       $(this).attr("disabled", true);
 });

Not sure if you are doing this on page load, or on a link/button click, but this is a start.

Comments

0
$('#your_form_id [readonly]').removeAttr("readonly").prop("disabled",true);

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.