SHARE
TWEET

Untitled

a guest Dec 9th, 2012 44 Never
  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>
RAW Paste Data
Top