Advertisement
Guest User

Untitled

a guest
Dec 9th, 2012
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script src="http://code.jquery.com/jquery-latest.js"></script>
  4. <script>!window.jQuery && document.write(unescape('%3Cscript src="js/jquery-1.7.2.min.js"%3E%3C/script%3E'))</script>
  5. </head>
  6. <body>
  7. <div>happy New year</div>
  8. <script>var elements = $('div');
  9.  
  10. // go through the elements and find the one with the value
  11. elements.each(function(index, domElement)) {
  12. var $element = $(domElement);
  13.  
  14. // does the element have the text we're looking for?
  15. if ($element.text() === "happy New year") {
  16. $element.hide();
  17. // hide the element with jQuery
  18. return false;
  19. // jump out of the each
  20. }
  21. }
  22. </script>
  23. </body>
  24. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement