Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7668037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:15:22+00:00 2026-05-31T15:15:22+00:00

Here is my problem summarized in the following JS Fiddle : http://jsfiddle.net/sidou/3R5B2/ I need

  • 0

Here is my problem summarized in the following JS Fiddle :
http://jsfiddle.net/sidou/3R5B2/

I need to make an autocomplete field with multiple values (which is correctly done in the first part of the attached script) but I also want it to be accent insensitive when fetching the autocomplete suggestions compared to the input string (exactly as it works in the second part of the attached script).

How to merge both behaviors? or in other words, how to simply make the first autocomplete field accent insensitivewhile keeping the multiple values selection feature.

You can try it by typing the word “caféteria”

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:15:23+00:00Added an answer on May 31, 2026 at 3:15 pm

    Here, I fixed it for you: http://jsfiddle.net/cps7/3R5B2/7/. Second input acts as you wanted.

    $(function() {
      var keywordz = [
        "Caféteria",
        "AppleScript",
        "Asp",
        "BASIC",
        "C",
        "C++",
        "Clojure",
        "COBOL",
        "ColdFusion",
        "Erlang",
        "Fortran",
        "Groovy",
        "Haskell",
        "Java",
        "JavaScript",
        "Lisp",
        "Perl",
        "PHP",
        "Python",
        "Ruby",
        "Scala",
        "Scheme"
      ];
    
      //////////////FIRST AUTOCOMPLETE WITHOUT ACCENT CHECK///////////////
    
      function split(val) {
        return val.split(/,\s*/);
      }
    
      function extractLast(term) {
        return split(term).pop();
      }
    
      $('#keywords')
        .keydown(function(e) {
          if (e.keyCode === $.ui.keyCode.TAB &&
            $(this).data("autocomplete").menu.active) {
            e.preventDefault();
          }
          if (e.which == 13) {
            e.preventDefault();
          }
    
          $('#keywords').autocomplete({
    
            minLength: 1,
            autoFocus: true,
            source: function(request, response) {
              // delegate back to autocomplete, but extract the last term
              response($.ui.autocomplete.filter(
                keywordz, extractLast(request.term)));
            },
            focus: function() {
              // prevent value inserted on focus
              return false;
            },
            select: function(event, ui) {
              var terms = split(this.value);
              // remove the current input
              terms.pop();
              // add the selected item
              terms.push(ui.item.value);
              // add placeholder to get the comma-and-space at the end
              terms.push("");
              this.value = terms.join(", ");
              return false;
            }
    
          })
        })
      //////////////END OF FIRST AUTOCOMPLETE WITHOUT ACCENT CHECK//////////
    
      //////////////SECOND AUTOCOMPLETE WITH ACCENT CHECK///////////////
    
      var accentMap = {
        "à": "a",
        "â": "a",
        "é": "e",
        "è": "e",
        "ê": "e",
        "ë": "e",
        "ï": "i",
        "î": "i",
        "ô": "o",
        "ö": "o",
        "û": "u",
        "ù": "u"
      };
      var normalize = function(term) {
        var ret = "";
        for (var i = 0; i < term.length; i++) {
          ret += accentMap[term.charAt(i)] || term.charAt(i);
        }
        return ret;
      };
    
    
      $('#keywords2')
        .keydown(function(e) {
          if (e.keyCode === $.ui.keyCode.TAB &&
            $(this).data("autocomplete").menu.active) {
            e.preventDefault();
          }
          if (e.which == 13) {
            e.preventDefault();
          }
    
          $('#keywords2').autocomplete({
    
            minLength: 1,
            autoFocus: true,
            //with accent check        
            source: function(request, response) {
              var matcher = new RegExp($.ui.autocomplete.escapeRegex(extractLast(request.term)), "i");
              response($.grep(keywordz, function(value) {
                value = value.truc || value.value || value;
                return matcher.test(value) || matcher.test(normalize(value));
              }));
            },
            focus: function() {
              // prevent value inserted on focus
              return false;
            },
            select: function(event, ui) {
              var terms = split(this.value);
              // remove the current input
              terms.pop();
              // add the selected item
              terms.push(ui.item.value);
              // add placeholder to get the comma-and-space at the end
              terms.push("");
              this.value = terms.join(", ");
              return false;
            }
    
          })
        })
      //////////////END OF SECOND AUTOCOMPLETE WITH ACCENT CHECK//////////
    });
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    multi values autocomplete: <input type="text" id="keywords" size="50">
    <br/><br/> accent insensitive autocomplete: <input type="text" id="keywords2" size="30">
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

jsFiddle of the problem here. When I have an image with align=left inside a
Pretty much it summarizes my problem here: Double check - does it ever make
My problem here is the following : i am developing a website where Lecturers
Small problem here. I have an event created on Facebook and am using the
Maddening problem here. When my page loads: <body onload=getClientDateTime();> It runs this function: document.getElementById('ClientDateTime').value=hello
date here my problem: String datetime = 2012-03-24 23:20:51; I know that that string
Super weird problem here. I'm having trouble getting jQuery to bind any selectors except
What is the problem here? (Besides having redundant code). $.getJSON works as expected. However
I have a problem here. My Zend_Forms do not render in view script. Via
I have a problem here I can't solve. I have a database of houses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.