Instantiating a jQuery plugin multiple times, triggers multiple click events.
I am writing a pretty simple jQuery plugin that slices `ul` and `ol` elements and appends a `More/Less` link to the bottom. The plugin works fine if I initiate it once on the page.but say if I've got to use it on different lists with different options and i instantiate it on different elements on the same page. It works, but a lil messed up.
So say if I use it on 2 lists on a page. The first list gets Instantiated 2 times therefore making click events to be triggered 2 times, Now, if I add another list and instantiate my plugin on 3 lists the 1st list gets instantiated 3 times making click events to be triggered 3 times. the second list list gets instantiated 2 times making click events to be triggered two times and only the last list works as expected.
Please tell me what is it I am doing wrong ?