What can JavaScript do?

      No Comments on What can JavaScript do?

JavaScript can change the style of an HTML element

Changing style of an HTML element

See JavaScript change me

<p  id="demo">See JavaScript change me</p>
<button onclick="document.getElementById('demo').style.fontSize='35px'">Click me</button>

JavaScript is used to change HTML attributes of elements.

JavaScript can change HTML attributes

JavaScript can

<img id="myImage" src="star.png" alt="JavaScript can">
<button class="btn btn-default" onclick="document.getElementById('myImage').src='star1.png'">Add to  favorites</button>
<button class="btn btn-default" onclick="document.getElementById('myImage').src='star.png'">Remove from favorites</button>

Leave a Reply

Your email address will not be published. Required fields are marked *