Link to home
Start Free TrialLog in
Avatar of maqskywalker
maqskywalker

asked on

jquery contains method to look for a paragraph tag

Hi experts,

I have this fiddle

https://jsfiddle.net/k0nfs2e9/

it looks like this:
User generated image
In this fiddle i'm doing this:

// look for all elements using this class DivStyle1 and append the image to the one that contains this string Div 3
$('.DivStyle1:contains("Div 3")').append(img);  

That works fine.

How do i revise it, so it instead of looking for this string "Div 3"  I look for the <p> tag instead.

I tried this but it didn't see to work:

// look for all elements using this class DivStyle1 and append the image to the one that contains this tag <p>
$('.DivStyle1:contains("<p>")').append(img);  

Any ideas of what I'm doing wrong?
ASKER CERTIFIED SOLUTION
Avatar of Thomas Wheeler
Thomas Wheeler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of maqskywalker
maqskywalker

ASKER

thanks