0
What is the function of JavaScript snippets ?
<head><script>function myFunction(){document.getElementById("demo").innerHTML="Paragraph changed";}</script></head>
2 Réponses
0
The above code snippet just change the paragraph content to "Paragraph changed".
explanation:
myFunction() is a function which performs this operation. It contains inbuild functions:
1) getElementById() which has a parameter demo.
It checks all element in a HTML DOM(Document Object Model) (basically a tree which has all html elements in your webpage as nodes) & selects element with id "demo".
2) innerHTML is a JavaScript construct which is used to change the contents of the HTML elements.
Happy Coding....😊
0
thank you