I have the following code:
$('.groupselect').livequery(function(){ $('.groupselect').unbind().change(function(){ _this = this; _id = $(_this).attr('id'); //alert($(_this).val()); alert($(_this).attr('id')); }); });
I can take the value from the element, but i cant take the value from the id attribute, it returns blank.
puffpio almost had the answer. Here is an updated version:
This is assuming you want the id of the select element. If you wanted the id of an individual option element you could use:
Go here http://jsbin.com/urugo to see the first set of code in action. If you want to edit the code for the example go here http://jsbin.com/urugo/edit