I want to hide the second div after this div, there is no identifier for that div.
That's why I took this p tag attribute as an identifier. I tried using jQuery, but in page load it's sometimes visible. Is there any way to hide it permanently?
div p[data-udy-fe="text_-a91032"] {
}
I'm adding my jQuery code here, but when page loading we can see the div's content for some seconds. I need to hide it permanently, without the brief flash.
$("p").each(function(){
if($(this).attr('data-udy-fe') == 'text_-a91032') {
$(this).next('div').next('div').hide();
}
});
You can use + div + div selector
p[data-udy-fe="text_-a91032"]+ div + div {
display: none;
}
<div>
<div>Paragraph1</div>
<div>Paragraph2</div>
<p data-udy-fe="text_-a91032">Paragraph3</p>
<div>Paragraph4</div>
<div>this one is not displayed</div>
<div>Paragraph6</div>
<div>
You can use the general sibling combinator to select the p tag which occurs after your specific element.
div p[data-udy-fe="text_-a91032"] ~ p {
display: none;
}