javascript - jQuery - Get value of inputs in array -


for each input field on page, has id ending in "_name" , "_value", i've placed in 2 arrays. , each of values of input (there equal number of inputs namearr , valarr) in name array place before input of namrarr heading, hide input. however, cannot seem access value of input once it's placed in array??

var name = $("[id$=_name]"); var namearr = $.makearray(name); var val = $("[id$=_value]"); var valarr = $.makearray(val);  for(var = 0; < valarr.length; i++){     $(namearr[i]).before("<h3>"+namearr[i].val()+"</h3>");     $(namearr[i]).hide(); } 

you simplify it, jquery selector returning array:

$("[id$=_name]").each(function (index, item) {     $(this).before("<h3>" + $(this).val() + "</h3>");     $(this).hide(); }); 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -