get the last <P> in JSON object - Javascript jQuery

Javascript examples for jQuery:Json

Description

get the last <P> in JSON object

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>SO - 14805660</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from w w w .ja v  a2 s  . c o m*/
var x = $('<P>item 1</P><P>item 2</P><P>item 3</P>');
console.log(x);
console.log(x.filter('p'))
console.log(x.filter('p:last'))
console.log(x.filter('p').last())
    });

      </script> 
 </head> 
 <body>  
 </body>
</html>

Related Tutorials