Javascript examples for jQuery Selector:class
Add Class To Closest Element by selecting last element
<html> <head> <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"> </script> </head> <body> <span>test</span> <script> console.log($('span:last').text()); </script> <span>Not me</span> </body>//from w ww . java 2s.co m </html>