JSFiddle - React, Tailwind, and code Playground

by learningforever

HTML

<!DOCTYPE html>
<html>
<body>

<h2>What Can JavaScript Do?</h2>

<p>JavaScript can change HTML attribute values.</p>

<p>In this case JavaScript changes the value of the src (source) attribute of an image.</p>

<button onclick="document.getElementById('myImage').src='https://dummyimage.com/200x200/f50810/fff&text=On'">켜기</button>

<img id="myImage" src="https://dummyimage.com/200x200/000000/fff&text=Off" style="width:100px">

<button onclick="document.getElementById('myImage').src='https://dummyimage.com/200x200/000000/fff&text=Off'">끄기</button>

</body>
</html>