Skip to main content

SEARCH TABLE DATA JAVA SCRIPT

————————————————————————
CDN

https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.js
————————————————————————
HTML 

<input type="text" id="search" placeholder="Search">

————————————————————————
JS (any column)

 $("#search").on("keyup", function() {
                var value = $(this).val();
                
                $("table tr").each(function(index) {
                    if (index !== 0) {

                        $row = $(this);

                        var text = $row.text();
                        
                        if (!text.includes(value)) {
                            $row.hide();
                        }
                        else {
                            $row.show();
                        }
                    }
                });
            });

————————————————————————
JS (first column)

$("#search").on("keyup", function() {
    var value = $(this).val();

    $("table tr").each(function(index) {
        if (index != 0) {

            $row = $(this);

            var id = $row.find("td:first").text();

            if (id.indexOf(value) != 0) {
                $(this).hide();
            }
            else {
                $(this).show();
            }
        }
    });
});​

Comments

Popular posts from this blog

KrutiDev To Unicode Conversion

http://wrd.bih.nic.in/font_KtoU.htm ___________________________________ <html> <head> <title>KrutiDev <=> Unicode Conversion</title> </title> <link rel="stylesheet" href="style.css">       <script src='script.js'></script> </head> <!--       body of the HTML starts here. one text box is provided each for input and output. --> <body bgcolor='#99CCFF'> <P style='text-align:center; font-family: Arial, Helvetica, sans-serif; font-size: 14pt; font-weight:bold; background-color: #FF6600; color: #FFFFFF'> Conversion between Krutidev-010 and Unicode क्रुतिदेव-०१० और यूनिकोड के बीच रूपांतरण </P> <form name="form1"> <p style='font-size:10pt'>क्रुतिदेव-०१० (Kruti Dev 010) फॉन्ट में टंकिट टेक्स्ट को "क्रुतिदेव-०१०" नामक टेक्स्ट बॉक्स में टाईप या पेस्ट करें तथा इसे यूनिकोड में रूपांतरित करने के लिए अधोमुख तीर वाल...

Array Difference, Radio Button Js,

$a1=array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow"); $a2=array("e"=>"red","f"=>"green","g"=>"blue"); $result=array_diff($a1,$a2); print_r($result); ______________________________________________________ <script type="text/javascript">  $(document).ready(function(){       $("input[type='radio']").click(function(){             var radioValue = $("input[name='duration']:checked").val();             if(radioValue){                 alert("Your are a - " + radioValue);             }         });  }); </script>   $(document).on("click", ".upappdesc", function(){ // alert($(this).data('id'));  var option = $(this).data("cat").split(",");  // alert($(this).data(...

Update Node on Mac and Windows

Using brew: brew update brew upgrade node Using nvm:   NVM (Node Version Manager) is a tool that allows you to manage multiple versions of Node on your system. You can use nvm to install, update, and switch between different versions of Node. To update your version of Node using nvm, do the following: 1. Check if you already have nvm installed on your system:   
nvm --version 2. If it's not installed, install nvm using this command:    
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash 3. Once nvm is installed, check your current version of Node by running the following command: 
node -v 4. Then update your version of Node using the following command:   
nvm install node --reinstall-packages-from=node 5. And finally, verify that your update is complete by rechecking your Node version:   
node -v ———————————————————————————————————— Using NPM: To update Node using NPM, do the following: 1. Open the Terminal and check your curren...