jquery - multiple inputs with similar names -
Then I have some input with name session and they increase ... session 1 session 1 session 2. If I want to run them through a loop, how will I do this? I am using jquery.
For example
for (i = 0, i & lt; 10, i ++) {var num = (session + i) .value + I ; }
So what do I want to go through all the inputs with the prefix session and output their values in the loop and variable. It can be carried out in an array if the array clearly looks more.
num [i] = accessories + i;
Thanks.
OK, I'm going with javascript. Thanks for all the help it works great here was the last code.
function () {var alldata; Var value = []; $ ("Input [name = = 'media']). Each (function (i, anInput) {var check = value [i] = $ (anInput) .attr ('checked'); if (check == true) {Var ID = "session" + i; var type = $ (anInput) .attr ('value'); if (i> 9) {var cont = "#ex" + i;} and {var cont = "[Name = '" + id + "']";} var scope = $ (cont) .attr ('value'); if (! Alldata) {alldata = type + ':' + scope + ' ;;} Else alldata = alldata + '' + type + ':' + scope + '';};}) $ ('# session'). Attr ('value', alldata);}
starts with selector
^
And each
function like this:
var arr = new array (); $ ('in Every [function () (warning ($ (this) .val ()); // arr [] = $ (this) .val ();});
Comments
Post a Comment