Skip to content
Advertisement

Is there any on select event for select for jquery?

ok I’ve got a dropdown menu, and I use

$('select.small').change ...

It has a couple of options, the problem though, when I select the first option – nothing happens – because it is already selected. Is there any way to make it happen?

So far I was using an additional empty option, which was selected by default and did nothing, but now I’ve got to use this first and empty option for cleanout, so I just can’t add an additional default and empty option.

Advertisement

Answer

I have made it. And I will proudly answer myself,

$('select.small').bind('focus click',function(){
    $(this).children().removeAttr('selected');
});
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement