Change Each order of my plugin? $("#id3,#id1,#lid2).myPlugin()

Change Each order of my plugin? $("#id3,#id1,#lid2).myPlugin()

Hi guys,

I've wrote a plugin - and it works great for what I need - except I've noticed today that:

  1. return this.each(function() {

Puts the elements in the order they appear in the DOM.


So on my html page, I have this...

  1. <div id="id1"></div>
    <div id="id2"></div>
    <div id="id3"></div>

But I want to change the divs in the order I provide the plugin. Like this...

  1. $("#id3,#id1,#lid2).myPlugin()

The each function changes the order to how the elements appear on the page - 1,2,3 But this is no good.

Please can someone explain how I can make the plugin do its thing in the order I enter the elements

Thanks for the help!