javascript - How to run a function by clicking an option in a drop down select tag? -
i have drop down select tag :
<select id="thisdropdown" onchange="dosomething()"> <option></option> <option>classif</option> <option>status</option> </select>
notice i'm using onchange();
what need ability re-click option in drop down runs function again (as can change other drop downs affect outcome of running function).
i have tried onselect()
, onclick()
none seem work. have write bit of script ? have been looking online can't seem find work.
thanks in advance, sorry if similar has been asked before
we can achieve minor tweaks required based on browser
jsfiddle link https://jsfiddle.net/0kxe6br7/2/
var dom = "select#thisdropdown"; var is_firefox = navigator.useragent.tolowercase().indexof('firefox') > -1; if(is_firefox){ dom+=" option"; } $(dom).on("click",function(event) { console.log($(event.currenttarget).val()); });
Comments
Post a Comment