If the word "anything" is just part of the text inside the div, then it
doesn't have a DOM element (tag) of its own. This means you can't select it
with a jQuery selector or any kind of DOM manipulation, and you can't apply
a CSS style to it.

What you can do is rewrite the HTML content of your DIV element.

If you know for sure that there is only a single DIV with
class="tpSurveyQuestion", then it's simple:

    var $question = $('.tpSurveyQuestion');
    $question.html(
        $question.html().replace( 'anything', '<b>anything</b>' )
    );

If there may be multiple DIVs that match that selector, you need to handle
each one individually:

    $('.tpSurveyQuestion').each( function() {
        var $question = $(this);
        $question.html(
            $question.html().replace( 'anything', '<b>anything</b>' )
        );
     });

-Mike

On Thu, Nov 19, 2009 at 3:18 PM, Rua <ra2a...@gmail.com> wrote:

>
> Hi I'm trying to select a specific word inside a div and would like to bold
> it, I can't seem to find how to do this anywhere!
>
> $(".tpSurveyQuestion:contains('anything')").css("font-weight","bold");
> --
> View this message in context:
> http://old.nabble.com/Bolding-a-certain-word---string-manipulation--tp26421612s27240p26421612.html
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.
>
>

Reply via email to