Apu
June 03, 2023 .
#alt
.
#Attribute
❌
How to add alt text to an image using JavaScript
How to add alt text to an image using JavaScript. If you are thinking about this,then in this article, you are going to learn that.
<img src="https://app.3schools.in/logo.png">
In the above image element, there is no alt attribute . So, we will add an alt text to this element in javascript.
set image's alt attribute in javascript
<img id="myImg" src="https://app.3schools.in/logo.png"> <script> let img = document.querySelector('#myImg') img.alt="logo"; </script>Try it Yourself »
save
listen
AI Answer
How to add alt text to an image using JavaScript
0
How to add alt text to an image using JavaScript. If you are thinking about this,then in …
asked
Apu
0 answers
2915
How to add alt text to an image using JavaScript. If you are thinking about this,then in …
Answer Link
answered
Apu