www.webdeveloper.com
Results 1 to 6 of 6

Thread: Dynamic Search Tweak

  1. #1
    Join Date
    Mar 2014
    Posts
    5

    Dynamic Search Tweak

    I want my search to search only first column but still bring up the entire row. I also want exact search to be brought to the top of the list.
    For example; when I type "ad" ABLS come to the top because of the second column. Thanks for help.
    I am working it at jsfiddle:
    http://jsfiddle.net/jltjr/UmJ8u/

  2. #2
    Join Date
    Mar 2014
    Posts
    5
    Is this possible???

  3. #3
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,500
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  4. #4
    Join Date
    Mar 2014
    Posts
    5
    Quote Originally Posted by \\.\ View Post
    Sorry, I moved it to: http://www.webdeveloper.com/forum/sh...23#post1322823
    Thanks, for pointing it out.

  5. #5
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,671
    Code:
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8" />
    <title>123</title>
    <style>
    input{text-align:center;}
    </style>
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script>
    $(function(){
    var $cells=$('tr').find('td:first');
    $("#search").keyup(function() {
    var val=$.trim($(this).val());
    if(!val){$cells.parent().show();}
    else{
    $cells.parent().hide();
    $cells.filter(function(){
    return 0 == $(this).text().toLowerCase().indexOf(val);}
    ).parent().show();
    }
    });
    $('#search').focus();
    });
    </script>
    </head>
    <body>
    <label><input id="search" placeholder="Quick Search" type="text"></label>
    <table>
    <tr><td>AA</td><td>Active Army</td></tr>
    <tr><td>AAFES</td><td>Army and Air Force Exchange Service</td></tr>
    <tr><td>AAR</td><td>after action review</td></tr>
    <tr><td>ABLS</td><td>Advanced Burn Life Support</td></tr>
    <tr><td>ACASP</td><td>Army Civilian Acquired Skills Program</td></tr>
    <tr><td>ACCP</td><td>Army Correspondence Course Program</td></tr>
    <tr><td>ACE</td><td>American Council on Education</td></tr>
    <tr><td>ACTEDS</td><td>Army Civilian Training, Education, and Development System</td></tr>
    <tr><td>AD</td><td>active duty</td></tr>    
    </table>
    </body>
    </html>

  6. #6
    Join Date
    Mar 2014
    Posts
    5
    Worked great Padonak, thank you very much!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles