I use onClick JavaScript, it works well with IE / FF / Chrome browser, but does not work with Safari browser.
The code I use is as follows:
heartSelectHandler = { clickCount : 0, action : function(select) { heartSelectHandler.clickCount++; if(heartSelectHandler.clickCount%2 == 0) { selectedValue = select.options[select.selectedIndex].value; heartSelectHandler.check(selectedValue); } }, blur : function() // needed for proper behaviour { if(heartSelectHandler.clickCount%2 != 0) { heartSelectHandler.clickCount--; } }, check : function(value) { alert('Changed! -> ' + value); } } <select onclick="javascript:heartSelectHandler.action(this);" onblur="javascript:heartSelectHandler.blur()" id="heart" data-role="none"> <?php for ($i = 20; $i <= 150; $i++): ?> <option value="<?php echo $i; ?>"><?php echo $i; ?></option> <?php endfor; ?> </select>
source share