Quick JQuery-question: How can one decide which of two objects comes first in a code?
Edit: I want to do something like this.
var active = $("#second");
if(active is before $("#first")) ...
else ...
Ex:
<table>
<tr>
<td></td>
<td id="first"> </td>
<td> </td>
</tr>
</table>
<table>
<tr>
<td id="second"> </td>
<td> </td>
<td> </td>
</tr>
</table>
If you’re using jQuery 1.4+,
.add()will do the trick.Reference: http://api.jquery.com/add/
You can write a simple plugin for this:
Then use it like so: