Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
189
rated 0 times [  196] [ 7]  / answers: 1 / hits: 116539  / 14 Years ago, mon, august 2, 2010, 12:00:00

I have a form that pop up inside a layer, and I need to make everything inside that form read only regarding what type of input it is. Anyway to do so?


More From » jquery

 Answers
11

This is quite simple in plain JavaScript and will work efficiently in all browsers that support read-only form inputs (which is pretty much all browsers released in the last decade):



var form = document.getElementById(your_form_id);
var elements = form.elements;
for (var i = 0, len = elements.length; i < len; ++i) {
elements[i].readOnly = true;
}

[#96054] Thursday, July 29, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rocioblancac

Total Points: 699
Total Questions: 96
Total Answers: 108

Location: Libya
Member since Mon, Dec 7, 2020
4 Years ago
;