I have a plugin that uses the .live method (now deprecated) to execute code on a particular link. What’s the best way to piggyback more javascript onto this method without modifying the plugin’s original JS file?
I’d like to keep my changes as separated as possible so that updated the plugin is less of a headache, and only then involves me updating my code to work with any changes.
At first thought, I figured I could just call another .live (or .on per new method guidelines) on the same link, but would the code get executed both times and is that even good practice?
You can attach two event handlers to one element (the particular link). There’s nothing wrong with that.
See http://jsfiddle.net/5hPjL/