I found this cod on jquery web
$("select").change(function () {
var str = "";
$("select option:selected").each(function () {
str += $(this).text() + " ";
});
$("div").text(str);
})
.change();
I can use it for I want but I want this function to be fired only for #my_id. I tried to insert #my_id after both selects but then the function does nothing.
I though I could bind this function to only select with specific id.
That works fine for
select#my_id:Did you use
select #my_id(note the space) my mistake?The
select#my_idselector matches the<select id="my_id">element, theselect #my_idmatches anything with andid="my_id"that is a child of a<select>.