Link to home
Start Free TrialLog in
Avatar of Mark Branscum
Mark BranscumFlag for United States of America

asked on

Jquery Bold 3 specific words in a paragraph

at the moment I have
$(document).ready(function() {
    $(".meIntro p:contains('Name:')").css("font-weight", "bold");

Open in new window

But this makes bold the entire paragraph not the word ........
What I need is 3 specific words .. Name: Location: Skills: to be Bold

Also note ... this paragraph is the 3rd paragraph in a div with a class called meIntro

I need this to happen when document.ready
Avatar of Mark Branscum
Mark Branscum
Flag of United States of America image


Ok still searching this out ...... found this and I modified it a bit but it does work ...... honestly I do not fully understand it but hey guys jquery is new and I am learning

$(document).ready(function() {
    $(".meIntro p").each(function() {
        $(this).html($(this).html().replace(/Name:/g, "<strong>Name:</strong>"));


Open in new window

This does what I want for one word can it be modified for 3 words .... Name:    Location:   Skills:
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is a sample that demonstrates the solution above
Loved the example you sent me too .... well done and so simple too
You are welcome.