Article View: pl.comp.lang.javascript
Article #50828Re: jquery .each i array
From: Peter May
Date: Thu, 07 Jul 2011 15:35
Date: Thu, 07 Jul 2011 15:35
21 lines
1277 bytes
1277 bytes
W dniu 07-07-2011 15:24, smerf pisze:
> Dlaczego ten kod zwraca pusty alert ?
>
> var collection = $('input[id^="cartEditCustomWeight_"]');
> var data = new Array();
Wstaw tutaj:
alert(collection.length);
Wรณwczas sprawdzisz czy w collection jest jakikolwiek element.
> $.each(collection, function() {
> var id = $(this).attr('id').split('_')[1];
> data["a"] = $(this).val();
> });
> alert(data);
--
Peter
Technical Details
Message-ID:
<iv4jng$jer$1@news.onet.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!.POSTED!not-for-mailReferences:
<4e15b399$0$2458$65785112@news.neostrada.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!.POSTED!not-for-mail From: Peter May <peter.may@onet.pl> Newsgroups: pl.comp.lang.javascript Subject: Re: jquery .each i array Date: Thu, 07 Jul 2011 17:35:09 +0200 Organization: http://onet.pl Lines: 21 Message-ID: <iv4jng$jer$1@news.onet.pl> References: <4e15b399$0$2458$65785112@news.neostrada.pl> NNTP-Posting-Host: uw210.internetdsl.tpnet.pl Mime-Version: 1.0 X-Trace: news.onet.pl 1310052912 19931 80.55.152.210 (7 Jul 2011 15:35:12 GMT) X-Complaints-To: niusy@onet.pl NNTP-Posting-Date: Thu, 7 Jul 2011 15:35:12 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: <4e15b399$0$2458$65785112@news.neostrada.pl> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit