Monday, 11 September 2017

JavaScript Introduction with Example

JavaScript Introduction with Example

code , JavaScript , JavaScript code , JavaScript code With Example , How to , How to Use JavaScript, Example Of JavaScript

JavaScript Can Change HTML Content
One of many JavaScript HTML methods is getElementById().

This example uses the method to "find" an HTML element (with id="demo") and changes the element content (innerHTML) to "Hello JavaScript":

Example :
<!DOCTYPE html>
<html>
<body>

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

<p id="demo">JavaScript can change HTML content.</p>

<button type="button" onclick='document.getElementById("demo").innerHTML = "Hello JavaScript!"'>Click Me!</button>

</body>
</html>

Post a Comment

Whatsapp Button works on Mobile Device only

Start typing and press Enter to search