Link to home
Start Free TrialLog in
Avatar of maqskywalker
maqskywalker

asked on

jquery selector find p tag in table cell

Hi experts,

I'm using jquery and html

I have this fiddle

http://jsfiddle.net/xdx1bffb/

This question is on using selectors and the jquery .hide method

When you run my current fiddle it looks like this:

User generated image
If you look at the html that was rendered, on google chrome inspector it looks like this:

 User generated image
If you notice the html code in my fiddle. In Table1 all the table cells use a class called ColStyle.  Only some of the table cells though have another table inside this cell. These are the cells in my picture that show "This is sample text".

This message is contained in a  <p> which is in a table cell.

So now I want to use the jquery .hide()  method to hide some images.

This essentially the criteria to hide the images that i need:

Within the tables cells with this class ColStyle that contain a p tag, hide the image that is inside those cells.
I specifically want to look for the p tag. So any cells with a p tag in it. Hide the image in that cell.

So my desired result should looks like this:

User generated image
I started out with this syntax , but not sure about how to then add the part to hide the image.

$('.ColStyle p').hide();

Anyone know the correct syntax?
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

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
SOLUTION
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

Not sure if i understood.

Here is my revised fiddle:

http://jsfiddle.net/s9u9sasd

But it's not hiding the images.