Possible Duplicate:
JQuery function doesn't work on Chrome on Mac, but works on Chrome on Win 7 and all other browsers
I have a select - option list
<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 this works on a PC but not on mac?
$('.social-option select').on('click', function () {
alert('bla');
});
http://jsfiddle.net/4BBcZ/
UPDATE
I need to use on click event, not on change.
Use the change
event instead:
$('.social-option select').on('change', function () {
alert('bla');
});
From the documentation:
The change event is sent to an element when its value changes. This event is limited to elements, boxes and elements. For select boxes, checkboxes, and radio buttons, the event is fired immediately when the user makes a selection with the mouse, but for the other element types the event is deferred until the element loses focus.
IIRC, the click
event works for <option>
s in Firefox, however does not work in Chrome. The best, most supported event is change
.
To get the value of the option selected, simply use .val()
as you would with any other input:
$('.social-option select').on('change', function () {
alert($(this).val());
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With