$(this) Selector in jQuery
home
Run
screen_rotation
fullscreen
cloud_download
<!DOCTYPE html> <html> <head> <title>jQuery $(this) 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(){ $("#demo").click(function(){ $(this).css("border","4px solid red"); $(this).css("color","black"); $(this).css("font-size","36px"); alert("You Invoked me And all properties are applied using $(this) reference"); }); }); </script> </head> <body> <a href="javascript:void(0)" id="demo"> Click this element to invoke me.. </a> </body> </html>
<!DOCTYPE html> <html> <head> <title>jQuery $(this) 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(){ $("#demo").click(function(){ $(this).css("border","4px solid red"); $(this).css("color","black"); $(this).css("font-size","36px"); alert("You Invoked me And all properties are applied using $(this) reference"); }); }); </script> </head> <body> <a href="javascript:void(0)" id="demo"> Click this element to invoke me.. </a> </body> </html>
Copyrights@tutorialsplane.com