Insert extra text in the beginning on the paragraph

In this example below you will see how to do a Insert extra text in the beginning on the paragraph with some HTML / CSS and Javascript

Using JS insert extra text into the beginning of the paragraph

Thumbnail
This awesome code was written by togrul, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright togrul ©
  • HTML
  • CSS
  • JavaScript
       <div id="text">
       - Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sint cumque nostrum, tempora non iste doloremque! Molestias dolore quisquam eaque, libero qui voluptas impedit, exercitationem delectus, fugit necessitatibus natus blanditiis assumenda.
   </div>


/*Downloaded from https://www.codeseek.co/togrul/insert-extra-text-in-the-beginning-on-the-paragraph-VvOExE */
    #text {color: green;}


/*Downloaded from https://www.codeseek.co/togrul/insert-extra-text-in-the-beginning-on-the-paragraph-VvOExE */
            var hello = document.createElement('strong');
        hello.innerText = 'Location - Date';
        var myDiv = document.getElementById('text');
        myDiv.insertBefore(hello, myDiv.firstChild);

Comments