How to sort these using Javascript/JQuery Most effectively
<div>6</div>
<div>2</div>
<div>7</div>
<div>5</div>
<div>9</div>
<div>4</div>
<div>8</div>
<div>1</div>
<div>3</div>
How to sort these using Javascript/JQuery Most effectively
<div>6</div>
<div>2</div>
<div>7</div>
<div>5</div>
<div>9</div>
<div>4</div>
<div>8</div>
<div>1</div>
<div>3</div>
You can use the
sort()
method to organise thediv
elements in to the required order, thenappend()
them to the containing element in that order. Try this: