Why can't you just use the DOM?
var inputFields = document.getElementById('form_id').getElementsByTagName('input');
for (var i = 0, l = inputFields.length; i < l; i++) {
// Do something with inputFields[i] ...
}
If you must use regex:
var formHTML = document.getElementById('form_id').innerHTML;
var inputs = formHTML.match(//g);
Note, the above regular expression is not reliable and will not work in ALL situations, hence why you should use the DOM! :)
No comments:
Post a Comment