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?
Advertisement
Answer
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; }