Skip to content Skip to sidebar Skip to footer

Is There Any Way To Fire A Click Event On A Select Element In Chrome Even If The Selected Option Doesn't Change?

I've got a SELECT element whose contents (OPTION elements) get loaded via AJAX and inserted on ready and when a different SELECT is changed. Both SELECTS have two OPTION elements a

Solution 1:

At Slavo's suggestion in the comments, I forced all browsers to make the first option be selected upon AJAX injection:

// force select the first option (fixes a Chrome issue)
$('#theSelect option:selected').removeAttr('selected')
$('#theSelect option:first-child').attr('selected', 'selected');

This standardizes the browser behavior and makes Chrome select the disabled option instead of defaulting to the enabled "Edit..." option.

Post a Comment for "Is There Any Way To Fire A Click Event On A Select Element In Chrome Even If The Selected Option Doesn't Change?"