Printing to the screen;
- Printing to HTML objects –
- Printing to HTML page –
- Printing to the alert window –
- Printing to the browser console –
After the selection process, we can change the content of the selected HTML object with the
<p id="p1"></p> <script> document.getElementById("p1").innerHTML = "baransel.dev"; </script>
<p>This is a paragraph</p> <script> document.write("baransel.dev"); </script>
document.write() method is used as a result of an event, all HTML elements on the page will be deleted.
<p>This is a paragraph</p> <button onclick="document.write('baransel.dev')">Click here</button>
<p>This is a paragraph</p> <script> alert("baransel.dev"); </script>
You can use
<p>This is a paragraph</p> <script> console.log("baransel.dev"); </script>
NOTE: The Console Screen section of your browser must be active to see the result.