Advanced Search

Results 1 to 4 of 4

Thread: Autocomplete Jquery Only Matches First Character from the result

  1. #1
    Join Date
    Apr 2012
    Posts
    81
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Autocomplete Jquery Only Matches First Character from the result

    I am attaching a file of Autocomplete.js
    I am having problem like it is matching only first characters of results like following:

    I have these 4 results for example
    1) How are You?
    2) Where are you?
    3) Are you there?
    4) How is your health?

    When I type H then all 4 results should come because all 4 statements are having H inside (There is no case sensitive issue).
    But it is giving only 2 results 1st & 4th. Means the first matching characters of statements. But I want all to come. I tried much but could not succeed but I am sure there is any parameter or something like that needs to be changed

    Is there any hope.

    Thanks
    Kaushaljquery.autocomplete.js

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,684
    Thanks
    43
    Thanked 3,128 Times in 3,094 Posts
    Blog Entries
    12

    Default

    You might want to read the documentation:

    http://www.devbridge.com/projects/au...ry/#how-to-use

    The first example site listed on the home page for this script works the way you say you want. It's search box is:

    Code:
    <input type="text" accesskey="4" title="Search for Items Here" name="q" id="q" class="searchbox" value="" />
    It's initialization is:

    Code:
      $(function () {
    
        $('#q').each(SetupDefaultSearchText);
    
        var onSelect = function (v, d) {
          if (d) {
            window.location = d;
          } else {
            $('#searchform').submit();
          }
        };
    
        $('#q').autocomplete({ serviceUrl: '/handlers/autocomplete.ashx', width: 390, minChars: 2, onSelect: onSelect });
    
      });
     
     function SetupDefaultSearchText() {
        var q = jQuery(this);
        var txt = q.attr('title');
        if (!txt) { return; }
        var onFocus = function () { if (q.val() == txt) { q.val('').removeClass('input-inactive'); } };
        var onBlur = function () { if (q.val() == '' || q.val() == txt) { q.val(txt).addClass('input-inactive'); } };
        q.focus(onFocus).blur(onBlur);
        onBlur();
      }
    The highlighted parts do not appear to be related to the autocomplete script.

    Also that site uses version 1.1, you have version 1.1.5. Probably not important.

    If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,708
    Thanks
    2
    Thanked 388 Times in 383 Posts

    Default

    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  4. #4
    Join Date
    Apr 2012
    Posts
    81
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Thank you jscheuer1 & vwphillips for your kind help. I am looking for http://jqueryui.com/autocomplete/ that looks very simple. I used that & resolved the problem.
    Thank you both of you once again.

    Thanks
    Kaushal

Similar Threads

  1. Resolved jQuery assign innerHtml to result of ajax
    By keyboard in forum JavaScript
    Replies: 2
    Last Post: 04-02-2012, 11:35 AM
  2. Resolved Joining result of multiple selects to get final result?
    By gwmbox in forum JavaScript
    Replies: 2
    Last Post: 01-04-2011, 12:18 PM
  3. Comparing Two Arrays, printing matches
    By thesprucegoose in forum JavaScript
    Replies: 2
    Last Post: 04-01-2009, 02:32 PM
  4. Replies: 1
    Last Post: 02-16-2009, 03:40 AM
  5. [DHTML] AutoComplete with AJAX
    By BYK in forum Submit a DHTML or CSS code
    Replies: 8
    Last Post: 09-18-2008, 03:02 PM

Tags for this Thread

Bookmarks

Posting Permissions

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