Jquery autocomplete highlight text -


I want to create matching text in the autocomplete string, I have received a lot of help from this.

This is not for a word or word that is in sequence, I do not make any difference to bold words, in order to do it.

I want to match each word in string bold

  var t = "Cadbury gem 100 g delicious"; () '); () '); () '; $ .eEch (word ARR, function (i) {console.log (word ARR [ii]); verre = new regx ("^" + word ARR [i], "i"); t = t. relist ( Then, "& lt; span style = 'font-weight: bold; color: blue;' & gt;" + wordArr [i] + "");}) console.log ); Var li = $ ("
  • " //.data("item.autocomplete ", item) .append (" & lt; a style = 'text-align : Left '& gt; "+ T +" & lt; / a & gt; ") .appendTo ($ (' # ul '));
  • my

    I have $ Tried with each but does not work any ideas. Make this a build with the jQuery UI widget factory:

     

    code> $ Widget ("custom.autocompleteHighlight", $ .ui.autocomplete, {_renderItem: function (ul, item) {var regexp = new RegExp ('(' + this.term + ')', 'gi'), ClassString = this .options.highlightClass? 'Class = "' + this.options.highlightClass + '' ', label = item.label.replace (regexp,' & lt; span '+ classString +'> $ 1 & lt;
  • AppendTo (UL);}}});

    You can now use it with:

      $ ('input .jsAutocompleteHighlight '). AutocompleteHighlight ({highlightclass:' ui-autocomplete-hightlight '});  

    CSS styling:

      .ui-autocomplete-highlight {Font-weight: bold;}  

  • Comments

    Popular posts from this blog

    Member with no value in F# -

    java - Joda Time Interval Not returning what I expect -

    c# - Showing a SelectedItem's Property -