Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

show hide search

<!DOCTYPE html>
<html>
<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
    $(document).ready(function() {
       //$('[data-slide="0"]').addClass('demo');
       $("#mytxt").on("blur", function(){
           $("p").each(function(){
               alert($(this).html().toLowerCase().indexOf($("#mytxt").val()));
               if($(this).html().toLowerCase().indexOf($("#mytxt").val())>=0)
               {
                   $(this).addClass('show');
               } else {
                   $(this).addClass('hide');
               }
               
           });
       });
    });
</script>
<style>
.demo {
    font-size: 150%;
    color: red;
}
.hide {
    
    display: none;
}

.show {
    display: block;
}
</style>
</head>
<body>
<input type="textbox" id="mytxt">
<p data-slide="0">Rocky</p>
<p data-slide="1">Amit</p>
<p data-slide="2">John</p>

</body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.