Can't figure out how to physically change index order of selected elements
I'm attempting to physically change the index order of the elements returned by a selector. For example, I'm attempting to make it so when someone clicks on a button, it swaps the index position of the element above or below it (depending on which button they press). I tried to assign it using something like
- $('.draggable :eq(2)').attr('index', 3)
But it didn't seem to work. Is there a way to do it using jQuery, or do I have to change it within DOM itself? Or is there another way to do it?