lundi 8 août 2016

Move checkboxes on checked jQuery

I want to move the checkboxes if they are checked.

<div id="chkboxes">
<input type="checkbox" name="city" id="1"/> One <br />
<input type="checkbox" name="city" id="2"/> Two <br />
<input type="checkbox" name="city" id="3"/> Three   <br />
<input type="checkbox" name="city" id="4"/> Four    <br />
<input type="checkbox" name="city" id="5"/> Five    <br />
</div>

So if any checkbox is checked, it should move on the top of the list. How do I do that with jquery?

I am trying to build the pseudo code, but not able to get the logic.

Thanks.




Aucun commentaire:

Enregistrer un commentaire