How can I prevent rendering of some specific html tag content? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I prevent rendering of some specific html tag content?

Suppose I have this code. <div> <img src='my.png' /> </div> I want that only the div tag is displayed not it's content ( in this case it's img). Or better say the I want the div to be rendered not the img tag within it. Is there any way of doing it ? Or any alternate method will do. Plz help.

14th May 2019, 4:26 AM
S O U ✌️ I K
S O U ✌️ I K - avatar
3 Answers
+ 1
You could set the style of the image to display:none
14th May 2019, 5:34 AM
Dragonxiv
Dragonxiv - avatar
+ 1
You could not add the img tag. And only if you wanna show it than add it with javascript to the html. Or you could search for lazyloading. And that should help you to only load images that are on tge screen visible.
14th May 2019, 6:24 AM
Dragonxiv
Dragonxiv - avatar
0
Dragonxiv But it does not prevent the browsers from requesting the image. I don't want that.
14th May 2019, 6:13 AM
S O U ✌️ I K
S O U ✌️ I K - avatar