I have this piece of code and the variable toto has the same value in each cells of the array (the other threads say that a scope problem but I use var titi=jQuery(this).text(); and titi=jQuery(this).text();
HTML
<table name='xnnjz'><tr><td>1</td><td>2</td><td>3</td></tr></table>
JavaScript
var i=0;
jQuery("table['name=xnnjz'] tr.child-of-application"+indep+" td").each(function () {
var titi=jQuery(this).text();
toto[i]=titi;
i=i+1;
});
console.log(toto);
In console log :
toto=[3,3,3]
Could you help me?
You have to define the array out side each to access it out side each, Also modify your selector as I could not see any class
child-of-applicationLive Demo
Simplified version of above
Live Demo
You can also use jQuery map()
Live Demo