<html> <head> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> </head> <body> <h1>jQuery check if an element exists</h1> <script type="text/javascript"> $(document).ready(function(){ $("#buttonDiv1").click(function () { if($('#div1').length){ alert("Div1 exists"); }else{ alert("Div1 does not exists"); } }); $("#buttonDiv2").click(function () { if($('#div2').length){ alert("Div2 exists"); }else{ alert("Div2 does not exists"); } }); }); </script> </head><body> <div id="div1"> <b>This is DIV element which has an ide of "div1"</b> </div> <br/> <br/> <br/> <input type='button' value='div1 exists?' id='buttonDiv1'> <input type='button' value='div2 exists?' id='buttonDiv2'> </body> </html>
Wednesday, 12 September 2012
How To Check If An Element Exists In JQuery
Subscribe to:
Post Comments (Atom)
What should you required to learn machine learning
To learn machine learning, you will need to acquire a combination of technical skills and domain knowledge. Here are some of the things yo...
-
Introduction This article is aimed at people who are new to the world of Raspberry Pi [Like me]. It gives an idea about what Raspberry P...
-
A simple set of question framings was defined by Kipling in his immortal poem: I have six faithful serving men They taught me all ...
-
In this article we explain how to attain the goal of applying the SAP OpenUI5 user interface library to create line-of-business applicatio...
No comments:
Post a Comment