For my html , i dont have the data in tables , but they are structured in tags
its is something like
<div id="1"> name=abc id=501 </div>
<div id="2"> name=sdc id=502 </div>
<div id="3"> name=xyz id=503 </div>
Can i sort this using jquery/javascript php anything ! ?
Note the number of are variable , i.e decieded dynamically
DEMO
I changed your html to use data-attributes (the correct way to store data in your markup); it now looks like this
<div id='2' data-name='sdc' data-id='502'>sdc</div>. This also allows jQuery to retrieve the property readily using the.data()method.This sorts by name. To sort by id instead, change
return a.name > b.name ? 1 : -1;toreturn a.id > b.id ? 1 : -1;