I've an iframe loading a Form with input text, is it possible disable all the input just when the form is loaded into the iframe? without inserting the disable command in all the input field? Thanks F.
If the iframe content comes from the same domain as the main page, you can simply use jquery :
$(iframe).find('input').attr('disabled', 'disabled');
Without jquery, you have to iterate over forms and their inputs :
for (var i=0; i<iframe.forms.length; i++) {
var form = iframe.forms[i];
for (var j=0; j<form.elements.length; j++) {
form.elements[j].disabled = true;
}
}
Using JQuery, regardless of the domain of the main page: (include this in the iframe, assuming you control the source).
if (window!=window.top) {
$('input').attr('disabled', 'disabled');
}
Yes you can do it
First give an id for your form and basing that id value disable all the input fields
$(# id.input).attr("disabled","disabled");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.