Getting ID of all elements of a certain class into an array
Posted
by
Tommy Coffee
on Stack Overflow
See other posts from Stack Overflow
or by Tommy Coffee
Published on 2012-11-16T22:55:52Z
Indexed on
2012/11/16
22:59 UTC
Read the original article
Hit count: 211
jQuery
Here's what I' trying to do:
Currently I am using this to create an array of all elements matching the class name of '.cookie'. Right now I am getting the text value of that element, which is not what I need:
var getAllCookies = $('.cookie').text();
var cookiesArray = jQuery.makeArray(getAllCookies);
alert(cookiesArray[0]);
What I need is to find all elements of a certain class (.cookie), get that elements ID value and store that ID value inside of array.
© Stack Overflow or respective owner