Hi,
How can I find if each of the <p> tags contains <img> tag, then style the <p> tags which contain <img> inside them?
I have pre-set all <p> will have this style,
Code:
<style>
p { padding:0px 0px 20px 0px;}
</style>
The function to re-style the <p> which contains <img> inside them,
Code:
$(document).ready(function(){
if ($('p img').length >0) {
$("p img").css({
padding: '0px'
});
}
});
The HTML,
[HTML]<div id="content">
<p><img src="img.jpg"/></p>
<p>Lorem ipsum dolor sit amet</p>
<p><img src="img.jpg"/></p>
<p>Lorem ipsum dolor sit amet</p>
</div>[/HTML]
Is it possible?
Thanks,
Lau