0
I have a problem that is apparently simple but because of my lack of experience I am getting screwed. The thing is, I’m doing a database listing of a text, and this text already comes with the tags <p></p>
together. This information has been registered using Tinymce and it has the option to put media in the background, but this media comes in a style="background: url('url da imagem')"
and it comes inside my tag <p>
. Hence I need to do a style configuration with css but I can’t just affect the tag that contains the style with the background. I tried using jquery addClass and it worked but only if I click on <p>
.
--- HTML ----
<p>texto</p>
<p sytle="background: url('exemplo.com')"></p>
<p>outro texto</p>
--- Jquery ---
$(document).ready(function(){
$('p').click(function(){
$(this).addClass('teste')
});
});
---- CSS ---
.teste{
height: 500px
}
please add the javascript code you tried
– Pedro Sanção
I already added a piece of what I tried to do. My problem is that the text already comes with tags straight from the database
– Gabriel Schmidt Cordeiro