I need to extract the element name and class from a form passed to a function. Is there a way to accomplish this?
On the HTML side:
<form name="test">
<div>
<input type="text" class="test1" name="test2"/>
</div>
<div>
<input type="text" class="test3" name="test4"/>
</div>
</form>
<div>
<input type="button" data-ng-click="save(test)" />
</div>
And on the Javascript side:
$scope.save = function(form){
for(each element in the form)
(extract values of elements)
}
Is it possible to achieve this? My goal is to modify classes and attributes as needed.