Jquery hide span containing certain numbers - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:hide

Description

Jquery hide span containing certain numbers

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from w  w  w.jav a  2s .c  o  m
$("span").filter( function() {
    return $(this).text().match(/^[1-9]$/);
}).hide();
    });

      </script> 
 </head> 
 <body> 
  <span>good</span> 
  <span>2</span> 
  <span>3</span> 
  <span>4</span> 
  <span>5</span> 
  <span>ok</span>  
 </body>
</html>

Related Tutorials