Set selected on select change with jQuery
A kinda funny problem, im doin开发者_StackOverflow中文版g a .clone() on a select-element (for preview purpose) and the selected value isnt transferred. I.e my solution is to set selected="selected" on selectbox change.
But, i can't get it to work in any form. Ideas?
$("select").change( function() {
$(this).find("option:selected").attr("selected", "selected");
});
$(this).find("option:selected").attr("selected", "selected"); you are looking for the selected then change it to selected? hmmmm it doesn't make sense ;)
how about try something like this, $(this).find("option").eq(1).attr("selected", "selected");. This will make 2nd option selected
加载中,请稍侯......
精彩评论