jquery , selector, contains one of the text

Posted by Alexander Corotchi on Stack Overflow See other posts from Stack Overflow or by Alexander Corotchi
Published on 2010-05-06T01:24:26Z Indexed on 2010/05/06 1:28 UTC
Read the original article Hit count: 237

Filed under:
|

Hi ,

I need a help for one thing :

this is my jQuery idea:

        var text = "Some Text1, Some Text2, Some Text3";


        $("h3:contains('"+even one of  this string+"')").each(function() {
                $(this).append("<span>Some Text</span>");
        });

This is My HTML

            <h3 class="test1">Some Text2</h3>

            <h3 class="test1">Some Text1</h3>

            <h3 class="test3">Another Text</h3>

What I want in OUTPUT:

             <h3 class="test1">
                 Some Text2
                <span>Some Text</span>
            </h3>

            <h3 class="test1">
                Some Text1
                <span>Some Text</span>
            </h3>

            <h3 class="test3">Another Text</h3>

Thanks!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about string