I have a jQuery Plugin that I use myself which modifies the selected value of select items on a page.
In my own code the plugin automatically executes as soon as it is included in the page this code in the plugin file.
jQuery('Document').ready(function(){
jQuery('select').SelectOptions();
});
this automatically executes my plugin on all select
items on the page.
Obviously for people other than myself who might come across this on github I'd like to change this slightly. I still think the idea of auto execute is good but my question is.
- Don't setup autoexecute at all, let the developer call the code.
- Call autoexecute on All Select items and let the developer modify the code if he doesnt want that.
- Autoexecute, but modify my selector called in the plugin js file to modify only select tags with a particular class - such as below
.
jQuery('Document').ready(function(){
jQuery('select .selectoptions').SelectOptions();
});
Is there any established protocol for this?