Javascriptâš‘
- getElementById
<html>
<body>
<h2>JavaScript in Body</h2>
<p id="demo"></p> //we can use class selctor also
<script>
document.getElementById("demo").innerHTML = "My First JavaScript";
//we can use onClick() funcion also
</script>
</body>
</html>
Display properties in javascript JavaScript can "display" data in different ways:
- Writing into an HTML element, using innerHTML.
- Writing into the HTML output using document.write().
- Writing into an alert box, using window.alert().
- Writing into the browser console, using console.log().
- we can write this code in