Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How do you dynamically add a paragraph with stylized content to a page?

user-image
Question added by Feras Abualrub , Web Solutions Manager , Qistas for Information Technology
Date Posted: 2015/04/23
venkata Gowtham Vishnubotla
by venkata Gowtham Vishnubotla , Internship , Infosys Ltd

newParagraph = document.createElement(‘p’); newParagraph.setAttribute(‘class’, ‘myClass’); newText = document.createTextNode(‘this is a new paragraph’); newParagraph.appendChild(newText); myLocation = document.getElementById(‘parent_of_new_paragraph); myLocation.appendChild(newParagraph)

More Questions Like This