I do not know enough to change the following code, which will show me the word start with the characters entered. For example: If I type E or e, it shows me βElectrical, electronics, Mechanical , but I want only β Electrical, electronics β to be displayed. How do I do this?
I am using jquery autocomplete plugin .
source: function(request, response) { var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i"); response(select.children("option").map(function() { var text = $(this).text(); if (this.value && (!request.term || matcher.test(text))) return { label: text.replace( new RegExp( "(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(request.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi" ), "<strong>$1</strong>"), value: text, option: this }; }));
source share