#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0

    How to find a text programmatically and add range to that?


    Hello Developers,
    i am new to javascript and i stuck at some point so i need your help.So i am explaining my requirement here-

    i am having a combination of words (like 5 to 10 words) and within this combination of word the second word have to highlight
    But main problem is how to find these combination of words in innertext and add the range to that so that i will be able to get the selected word using window.getselection() ,

    please suggest me the code for this kind of requiremnt

    thanks
  2. #2
  3. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,153
    Rep Power
    183
    Using a Regular Expression to filter your range; should do the trick.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0
    can you please give the example code

IMN logo majestic logo threadwatch logo seochat tools logo