jQuery seems to not split
I am using the following code that contains a call to split
a list of ids.
$("#editlisting").live('click', function(event) {
//alert("hello");
editlistingid = $("tbody td.small input:check开发者_开发问答box:checked").map(function(i, el) {
return $(el).attr("id");
}).get();
eid = editlistingid.split(",");
alert(eid[0]);
editlead();
});
However, what I am finding is that it is not getting split at all.
editlistingid
will hold an Array
, as the result of get()
was assigned to it.
Without a parameter,
.get()
returns all of the elements:alert($('li').get());
All of the matched DOM nodes are returned by this call, contained in a standard array.
Source.
split()
works on a String
.
Splits a
String
object into an array of strings by separating the string into substrings.
Source.
You are trying to call a String
method on an Array
. That won't work.
It looks like you could use editlistingid
directly.
精彩评论