Manipulating HTML content using JS

I am able to perform the JavaScript variables program and manipulating the HTML content with


Please help me out regrading creating of JavaScript programs and including that JS file to HTML document properly. please instruct the steps to get desired output.

Hi @divyanarang97,

Please share your HTML and javascript code and a screenshot of the output. Use the triple backquote to write your code on forum.

The easiest way to modify the content of an HTML element is by using the innerHTML property.
Example explained:
The HTML document above contains a

element with id=“p1”
We use the HTML DOM to get the element with id=“p1”
A JavaScript changes the content of that element to “New text!”
To know more about this visit at:

Your question seems to be less informative. If you can share the HTML/JS code that would describe the problem in detail.

But I faced a similar issue hence posting this answer,

Recently I was on this topic “Manipulating HTML content using JS” and I was trying to run the program but my output was not as expected. So, turns out that the HTML code for this topic in the course has a tag misplaced. They have closed the second paragraph tag before the script tag. Hence the paragraph tag is unable to call your java script file which is called using tag .


By doing so, I got the expected output .

Hope this information was helpful.
Thank You.