My html something like:
<html>
...
<select class="ra1" id="rate2620_"> ... </select>
<select class="ra1" id="rate2621_"> ... </select>
...
</html>
I have a for that is generating me all the functions for every select like:
for (i=from; i> to; i--){
var ii = i.toString(); // ii = 2621 or 2620 or ...
$("#rate" + i + "_").live("change", {pos: ii} ,function(e){
sendValue($(this).val(),e.data.pos);
});
}
I want to change my code to a function that acts for class="ra1" Something like (not working) :
$('.ra1').live("change", function(e){
var id = $(this).children(":selected").attr("id"); // get the id element
id = id.replace(/\D/g,''); // convert from id="rate2620_" to> id="2620"
sendValue($(this).val(),id);
});
So {pos: ii} ii should be changed with id, but I really have no ideea how it works.