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 8115129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:21:50+00:00 2026-06-06T03:21:50+00:00

I need help in jquery. Thanks in advance. I am using autocomplete function of

  • 0

I need help in jquery. Thanks in advance.

I am using autocomplete function of jquery. There is a option for highlight. as like :-

highlight: function(match, keywords) {
            return match.replace(new RegExp("("+keywords+")", "gi"),'<b>$1</b>');
        }

It is working fine.. But i am getting result in HTML form. as like :-

<div id='22048,63' style='width:200px;text-align:left;'><div class='floatleft' style='width:165px'>(LAS) Las Vegas McCarran International Airport, Las Vegas, Nevada</div><div class='floatright' style='width:20px;padding-right:15px;'><img src='images/plane.gif' width='14' height='16' /></div></div>

Thats why if i enter in textbox “las” than it is replacing the class attribute from HTML and than my design has mashed up. Because “las” keyword is appearing in “Class”. So it is replacing this.

I want only replace text that i got in HTML.

Than tell me there is any option in jquery so i can do this..

Thanks & Regards

  • 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-06-06T03:21:51+00:00Added an answer on June 6, 2026 at 3:21 am

    You can use .text() function to get just the text without the HTML Tags. Example:

    function removeAllHtmlInsideDiv() {
        $(".example_1").html( $(".example_1").text() );
    };
    removeAllHtmlInsideDiv();
    

    In your case, it can be used as:

    highlight: function(match, keywords) {
        return (match.replace(new RegExp("("+keywords+")", "gi"),'<b>$1</b>')).text();
    }
    

    For Stripping HTML Tags from String:

    function stripHTML(html)
    {
        // var html = "<p>Some HTML</p>";
        var div = document.createElement("div");
        div.innerHTML = html;
        var text = div.textContent || div.innerText || "";
        return text;
    }
    

    So in your case, you need to put this way:

    stripHTML(highlight);
    

    Hope it helps! 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using an autocomplete Javascript function, and I need to extract the last
I need help getting a Grease Monkey with JQuery Script to run on a
I'm in need of help refining a jquery drop down navbar. The navigation can
I need help to use jConfirm with this existing code (php & Jquery &
Anyone, I need help, I got a task from my teacher, it's about jquery,
Need a little help with my jquery here I want all my button with
I need your help again :) I'm trying to do a plugin with jQuery
I am new to Jquery and need some help: I have a div, I
Need help writing a script downloads data from google insight using c# this is
I need help with a form validator. It validates everything like text and such

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.