I have the below HTML which is displayed via jQuery, it is a list of users - but I am trying to find a way to specify an id name which makes the appropriate my_list div move to the top of the order?
Example:
<div class="my_list" id="peter"><label class="name">Peter - <div id="peter_status"></div></label></div>
<div class="my_list" id="sam"><label class="name">Sam - <div id="sam_status"></div></label></div>
<div class="my_list" id="derek"><label class="name">Derek - <div id="derek_status"></div></label></div>
Would turn into the following if I was to specify Sam:
<div class="my_list" id="sam"><label class="name">Sam - <div id="sam_status"></div></label></div>
<div class="my_list" id="peter"><label class="name">Peter - <div id="peter_status"></div></label></div>
<div class="my_list" id="derek"><label class="name">Derek - <div id="derek_status"></div></label></div>
My attempt at creating some code to assist is below:
$( '<div class="my_list" id="sam">' ).insertBefore($( ".my_list" ).first());