The innerHTML property is used to get or replace the content of an HTML element.
grammar:
Object.innerHTML
Notice:
1.Object is the obtained element object, such as the element obtained by document.getElementById("ID").
2. Pay attention to writing, innerHTML is case-sensitive.
We get the <p> element through id="con", and output and change the content of the element. The code is as follows:
result: