skip to Main Content

Im making a site with html and js where the user inputs some text and after they enter it, it displays on the screen. How do I have it so that after every time the users input gets displayed, a line space gets added?

function doME() {
     nav.innerHTML = 'Welcome  ' + answers.value;
     Chatbox.innerHTML += " " + cbox.value;
}
login1.addEventListener('click',doME);

line four is where it displays what the user inputted, i want to add a linespace after the user input **

2

Answers


  1. Add HTML to the end of your javascript function doME:

    function doME() {
         nav.innerHTML = 'Welcome  ' + answers.value;
         Chatbox.innerHTML += " " + cbox.value + "<br/>";
    }
    login1.addEventListener('click',doME);
    
    Login or Signup to reply.
  2. JS

    function doME() {
        nav.innerHTML = `Welcome ${answers.value}`;
        Chatbox.innerHTML += ` ${cbox.value}<br/>`;
    }
    login1.addEventListener( 'click', doME );
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search