I have an array and it has some data in it. This array contains id, firstname, lastname, email, phone. I also have five form input elements. Now I want to add data in array in these elements. For example, ID should be inserted in ID form field, name should be inserted in name input element etc. how can I achieve this?
here is my code
insert_data_in_form: function(data) {
var form = $("#dataform");
var form_arr = new Array();
form.each(function(i) {
var form_el = form.children("input[type='textfield']");
form_arr.push(form_el);
console.log(data.length);
//for(var j = 0; j < 5; j++) {
form_el.val(data[i]);
//}
});
}