Thread View: pl.comp.lang.javascript
2 messages
2 total messages
Started by smerf
Thu, 07 Jul 2011 13:24
jquery .each i array
Author: smerf
Date: Thu, 07 Jul 2011 13:24
Date: Thu, 07 Jul 2011 13:24
10 lines
1040 bytes
1040 bytes
Dlaczego ten kod zwraca pusty alert ?
var collection = $('input[id^="cartEditCustomWeight_"]');
var data = new Array();
$.each(collection, function() {
var id = $(this).attr('id').split('_')[1];
data["a"] = $(this).val();
});
alert(data);
Re: jquery .each i array
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads