groenroos / minimalect

Minimal select replacement for jQuery
350 stars 52 forks source link

Attaching event after the select is initialized is not working #38

Open irshad-k opened 10 years ago

irshad-k commented 10 years ago

Firstly I would like to make all selects 'minimalect' at once (global.js) $("select").minimalect();

Then Individually add events in the corresponding html/jsp pages $("#caseSelect").minimalect({ onchange:function(v,t){ alert(t); } }); This does not fire onchange event!

tezball commented 10 years ago

I had the same prob You need to declare each one on it's own and add the onchange callback to the one you want the alert.

for eg //want call back $('#Vehicle').minimalect({ onchange: function (value, text) { alert(value); //alert(text); } });

//The rest $('#BikeSelect').minimalect(); $('#CarSelect').minimalect(); $('#TruckSelect').minimalect(); $('#Location').minimalect();

esifis commented 10 years ago

Hello If I declare minimalect like :

$("#p_orderby, #ipp").minimalect({ onchange: function(value, text) { .... } });

how can I get the id or the name of the element that fired ? Thanks