Sorting elements of array Using jQuery

Self-Innovator
Posted by Self-Innovator under jQuery category on | Points: 40 | Views : 1745
//Under head Section

<script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js">  
</script>

<script language="javascript" type="text/javascript">
//Sorting the Elements
$(document).ready(function() {
var elements = ["Sallu Bhai", "SRK", "Aamir"];
$("#main1").html(elements.join("<br/>"));
elements = elements.sort();
$("#main1").append("<p>After Sorting Elements</p>");
$("#main2").html(elements.join("<br/>"));
});
</script>

//Body Section
<body>
<form id="form1" runat="server">
<div id="main1">
</div>
<div id="main2">
</div>
</form>
</body>

Comments or Responses

Posted by: Virendradugar on: 4/9/2012 Level:Silver | Status: [Member] [MVP] | Points: 10
Good!!! I also found another article which explains all possible operation with Array using jQuery.

http://jquerybyexample.blogspot.com/2012/02/playing-with-array-in-jquery.html

Login to post response