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:
fiddle
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?
jQueryHTML

Avatar of undefined
Last Comment
maqskywalker

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Thomas Wheeler

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
maqskywalker

ASKER
thanks
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck