I’m getting a bit confused about this.
I have page with multiple dynamically generated forms so get the value of one element it would like like this:
$username = document.forms.adminAddUser1.username1.value;
Fine, but how would I write it in order to get the result from a loop like this:
$.getJSON('http://' + document.domain + '/open-source-cms/inc/admin/json/user.json', function ($data) {
$.each($data, function (entryIndex, $form) {
$username = document.forms.adminAddUser "array result here" ".username "array result here" .value;
alert($username);
});// End each loop
I’ve tried playing around with the code and I can’t get it right
Using CSS it is straight forward enough:
$.getJSON('http://' + document.domain + '/open-source-cms/inc/admin/json/user.json', function ($data) {
$.each($data, function (entryIndex, $form) {
var $username = $("form[name=adminAddUser" + $form.id + "] input[name=username" + $form.id + "]");
alert($username.val());
});// End each loop