Create Image Element with Attributes
mediumQuestion 17Create a new image element and set its src to "photo.jpg" and alt to "My Photo". Then append it to the div with id="imageContainer".
Platform-Provided HTML (READ-ONLY):
<div id="imageContainer">
</div>Steps:
1. Use document.createElement() to create a new <img> element
2. Set its src attribute to "photo.jpg"
3. Set its alt attribute to "My Photo"
4. Select the container and append the image to it
Expected output
<div id="imageContainer"> <img src="photo.jpg" alt="My Photo"> </div>
= newline. No newline after the last line.
Hints4 available
Sign in to use hintsTopics
HTML DOM
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.