$("selector").attr("id","idname");
Is it possible to use above for setting ID or Class of an element.
$("selector").attr("id","idname");
Is it possible to use above for setting ID or Class of an element.
hm i feel like i've said it thousands of times. The jQuery class selector returns an array of all HTML elements with that class. So, if you want to get data form those elements you need to loop over the array or access it directly.
$('.gg1').first().attr("id"); //returns the id of the first element with class gg1
$('.gg1')[1].attr("id"); //returns the id of the second element with class gg1
for(var i = 0; i < $('.gg1').legth; i++= {
console.log($('.gg1')[i]); } //loops over the cormplete HTML Collection