Why doesn't the selection box on mac chrome respond to a click event?

Possible duplicate:
The jQuery feature does not work on Chrome on Mac, but it works on Chrome on Win 7 and all other browsers

I have a list of choices

<div class="social-option"> <select name="hex_theme_options[social-service-1]"> <option selected="selected" value="facebook">facebook</option> <option value="0"></option> <option value="twitter">twitter</option> <option value="linkedin">linkedin</option> <option value="e-mail">e-mail</option> <option value="phone">phone</option> <option value="instagram">instagram</option> <option value="flickr">flickr</option> <option value="dribbble">dribbble</option> <option value="skype">skype</option> <option value="picasa">picasa</option> <option value="google-plus">google-plus</option> <option value="forrst">forrst</option> </select> </div> 

why does it work on pc but not on mac?

 $('.social-option select').on('click', function () { alert('bla'); }); 

http://jsfiddle.net/4BBcZ/

UPDATE
I need to use on click , not on change .

+4
source share
2 answers

Use change instead:

 $('.social-option select').on('change', function () { alert('bla'); }); 

From the documentation :

A change event is dispatched to an element when its value changes. This event is limited to items, boxes, and items. For select flags, check boxes, and radio buttons, an event is fired immediately when the user makes a selection with the mouse, but for other types of elements, the event is delayed until the element loses focus.

IIRC, the click event works for <option> in Firefox, however it does not work in Chrome. The best, most supported change event.

To get the value of the selected option, simply use .val() , as with any other input:

 $('.social-option select').on('change', function () { alert($(this).val()); }); 
+7
source

Instead of the click event, use change, as in

  $(".social-option select").change(function(){ alert('bla'); }); 

stack reference

+4
source

All Articles