Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
82
rated 0 times [  86] [ 4]  / answers: 1 / hits: 16675  / 13 Years ago, tue, april 5, 2011, 12:00:00

I have following object:



$(input:checkbox:checked)
[
<input class=​li_checker type=​checkbox category_uid=​1.3 category_language=​da>​,
<input class=​li_checker type=​checkbox category_uid=​1.3.1 category_language=​da>​
]


If there is any helper in jQuery which allows me to get value of category_uid for all elements and returns it as the another array? Expected result:



[1.3, 1.3.1]

More From » jquery

 Answers
59

Use map():



var myArray = $(input:checkbox:checked).map(function(){
return this.getAttribute(category_uid);
}).get();

[#92907] Sunday, April 3, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eanskylerg

Total Points: 524
Total Questions: 107
Total Answers: 100

Location: Colombia
Member since Mon, May 2, 2022
2 Years ago
;