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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:05:30+00:00 2026-06-08T11:05:30+00:00

Im using this jquery plugin for searching text : http://code.google.com/p/jquery-highlight/downloads/list .. But im not

  • 0

Im using this jquery plugin for searching text :”http://code.google.com/p/jquery-highlight/downloads/list “..

But im not able to wrap this code in angular js ,
I mean to say “i’m unable to write a directive to call this jquery plug in”…!!!

Updated :

Same post in Google group:

This is the group

  • 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-08T11:05:31+00:00Added an answer on June 8, 2026 at 11:05 am

    UPDATE: This is just an example. You can modify as per your needs.

    You don’t need RegExp comparison for that.
    Lets make simple use of javascript’s split() function

    1) Define a style for highlighting.

    .srchslctn{
        background-color: yellowgreen;
        color: red;
    }
    

    2) Your sample HTML

    <body>
        <div>
            <div id="serach-Paragraph">
                Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum
            </div>
            <input type="button" id="h" value="Highlight"/>
            <div id="target"></div>
        </div>
    </body>
    

    3) JavaScript

                $(document).ready(function(){
                $("#h").on('click',function(){
                    highlight(); 
                });
            });
    
            function highlight(){
                $("#target").empty();
                var mainString = $("#serach-Paragraph").html();
                var searchString = "ipsum";
                var arr = mainString.split(searchString);
                var len = arr.length;
                var finalString="";
                for(var i=0;i<arr.length;i++){
    
                    finalString+=arr[i];
    
                    if(i<len-1){
                        finalString+='<span class="srchslctn">'+searchString+'</span>';
                    }
                }
                $("#target").html(finalString);
            }
    

    Thats it….

    Explanation -: split() will break the targetString according to your searchString. This is similar to how we retrieve comma separated values. Only thing is in this case your search string acts like comma 🙂

    Then keep arr[0] as it is.
    Highlight your search string and append it to arr[0].
    Append arr[1] to above result and so on.

    Simple….


    Searched text as in you have to only highlight the matched part keeping rest of the text as it is?

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

Sidebar

Related Questions

I'm using this plugin for jquery called resize-crop: http://code.google.com/p/resize-crop/ The problem with this is
I'm using this great plugin: http://www.sanisoft.com/blog/2009/06/22/jquery-auto-correct-plugin/ But it's not working with 1.6.2 or greater...
I am using this jQuery plugin for text blink http://plugins.jquery.com/project/blink But I don't know
I have a form which is built dynamically using this jQuery plugin http://code.google.com/p/jquery-dynamic-form/ When
I am using this jQuery plugin: http://api.jquery.com/slideToggle/ I have this code: <div id=panel><form action=postit.php
I'm using this JQuery autocomplete plugin http://www.devbridge.com/projects/autocomplete/jquery/ in my project. I followed this tutorial
I am using this jQuery plugin in my app http://www.building58.com/examples/tabSlideOut.html It all works well
I'm using this jQuery plugin here: http://css-tricks.com/examples/MovingBoxes/ Has anyone used it or can you
Ok, here's my problem. Im using this plugin (http://james.padolsey.com/javascript/jquery-plugin-autoresize/) to autoresize my textarea when
I am using this jQuery plugin: http://demo.awkwardgroup.com/showcase/ I am trying to show a counter

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.