jQueryの.each()
関数を使って配列を設定しようとしていますが、正しく実行していないようですね。私は、さまざまなアラートをしようとするときjQuery .each()関数を使用して配列を設定しますか?
<div class="cheers" data-fname = "fname" data-lname="lname">some ish..</div><!-- going through a while loop!-->
は、その後、私は、その後、この
var arrayMe = [];
$(".cheers").each(function(index){
arrayMe[index] = $(".cheers").attr('data-fname')+","+$(".cheers").attr('data-lname');
});
のような何かをjqueryの機能を持っています:
をは私のようなHTMLの属性を持っています
alert(arrayMe); //this gives me the fname,lname
alert(arrayMe[0]); //this gives me the first fname,lname in the array
alert(arrayMe[0][1]); //this SUPPOSED to give me the first lname, but it gives me a letter...
完璧!私はそれが今働く方法を見る! – hellomello