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)
2 Réponses
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. 😸
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