I have some question about jquery selection. In my case, how to match if the option.value
equal something, mark a selected
for it. Online code here
The first time where you refer to this
it is not a jQuery object it is a DOM object and a DOM object doesn't have the val()
method. You should either use this.value
och $(this).val()
try this:
$("div#selection select.select option").each(function(){
if($(this).val()==num){
$(this).attr("selected","selected");
}
});