jQuery closest Method
home
Run
screen_rotation
fullscreen
cloud_download
<!DOCTYPE html> <html> <head> <title>jQuery Closest Example</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $( "a" ).closest("ul").css( "background","yellow" ); }); </script> </head> <body> <ul> <li>First Item</li> <li>Second Item</li> <li><a href="">Test </a> </ul> </body> </html>
<!DOCTYPE html> <html> <head> <title>jQuery Closest Example</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $( "a" ).closest("ul").css( "background","yellow" ); }); </script> </head> <body> <ul> <li>First Item</li> <li>Second Item</li> <li><a href="">Test </a> </ul> </body> </html>
Copyrights@tutorialsplane.com