jQuery parent Method
home
Run
screen_rotation
fullscreen
cloud_download
navigate_before
<!DOCTYPE html> <html> <head> <title>jQuery Demo 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(){ $( "#parentExample" ).on( "click", function(event) { $("p").parent(".myPara").css("background","yellow"); }); }); </script> </head> <body> <h4><a href="javascript:void(0);" id="parentExample">Click to run parent() Example </a></h4> <div style='border:2px solid blue;padding:10px;position:absolute;'> <div style='border:2px solid blue;padding:10px;'> <div style='border:2px solid blue;padding:10px;'> <p style="padding:10px; background: red;"> <span>Demo paragraph ...........click button to run example.......!</span></p> </div> <div style="padding:10px;" class="myPara"> <p style="padding:10px; background: red;" > <span>Demo paragraph ...........click button to run example.......!</span></p> </div> </div> </div> </body> </html>
<!DOCTYPE html> <html> <head> <title>jQuery Demo 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(){ $( "#parentExample" ).on( "click", function(event) { $("p").parent(".myPara").css("background","yellow"); }); }); </script> </head> <body> <h4><a href="javascript:void(0);" id="parentExample">Click to run parent() Example </a></h4> <div style='border:2px solid blue;padding:10px;position:absolute;'> <div style='border:2px solid blue;padding:10px;'> <div style='border:2px solid blue;padding:10px;'> <p style="padding:10px; background: red;"> <span>Demo paragraph ...........click button to run example.......!</span></p> </div> <div style="padding:10px;" class="myPara"> <p style="padding:10px; background: red;" > <span>Demo paragraph ...........click button to run example.......!</span></p> </div> </div> </div> </body> </html>
Copyrights@tutorialsplane.com