jQuery has Method Example
home
Run
screen_rotation
fullscreen
cloud_download
<!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(){ $( "#hasExample" ).on( "click", function(event) { $("div").has("span").css("background","green"); }); }); </script> <style> div{ margin:10px; height:100px; width:100px; border:2px solid red; float:left; } </style> </head> <body> <h4 ><a href="javascript:void(0);" id="hasExample">Click to run .has("span") Example </a></h4> <div>0</div> <div><span>1 (Contains span...)</span></div> <div>2</div> <div><span>3 (Contains span...)</span></div> <div>4</div> <div>5</div> <div><span>6(Contains span...)</span></div> <div>7</div> <div>8</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(){ $( "#hasExample" ).on( "click", function(event) { $("div").has("span").css("background","green"); }); }); </script> <style> div{ margin:10px; height:100px; width:100px; border:2px solid red; float:left; } </style> </head> <body> <h4 ><a href="javascript:void(0);" id="hasExample">Click to run .has("span") Example </a></h4> <div>0</div> <div><span>1 (Contains span...)</span></div> <div>2</div> <div><span>3 (Contains span...)</span></div> <div>4</div> <div>5</div> <div><span>6(Contains span...)</span></div> <div>7</div> <div>8</div> <div></div> </body> </html>
Copyrights@tutorialsplane.com