69
rated 0 times
[
74]
[
5]
/ answers: 1 / hits: 16833
/ 8 Years ago, sun, february 14, 2016, 12:00:00
To do checking on required fields and a custom method of alerting users that required fields are missing, I'm trying to get an array of elements in a form, and have been hunting but not finding a good method.
Is there some variation of
document.getElementById(form).elements;
that would return all the required elements of an array, or a way to test if a given element is required... something akin to either
var my_elements = document.getElementById(form).required_elements;
or
var my_elements = document.getElementById(form).elements;
for (var this_element in my_elements){
if (this_element.attributes[required] == false){
my_elements.splice(this_element, 1);
}
}
More From » forms