Can you hide a specific photo from a web page? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can you hide a specific photo from a web page?

Can you Hide or change the size of a photo on a web page, without using getElementById?... (Just the name of the photo or the link of a specific photo on the page) (JAVASCRIPT)

30th Oct 2019, 4:14 PM
ztonaz
ztonaz - avatar
2 Answers
0
Don't want to use document.getElementById? Given the name of image on page like: <img name="myimg"> You can use : let i = document.getElementByName('myimg'); Or if it's first image in page let i=document.getElementsByTagName('img')[0]; //0 may be replaced with corresponding image no -1 let i=document.querySelector('#myimg'); If myimg is id of image. Then you hide image by using : i.style.visibility='hidden'; Or just use some css? Resizing won't be hard. i.style.height='20px'; i.style.width='20px'; There are many methods, just try to do some google search. 😸
30th Oct 2019, 5:35 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
0
Isn't there a possibility that once the page is loaded... Search for the name of the photo and the extension (in case it doesn't have class or Id or tag)... And resize the photo or hide it in case the photo exists
31st Oct 2019, 12:13 AM
ztonaz
ztonaz - avatar