Pass array returned from jQuery to a function
<html> <head> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ function disp(divs) { var a = []; for (var i = 0; i < divs.length; i++) { a.push(divs[i].innerHTML); } alert(a.join(" ")); } disp( $("p").get().reverse() ); }); </script> </head> <body> <body> <p>A</p><p>B</p> </body> </html>