[Solved] how to add a users input in javascript into html


Create p tag with any unique id and if user entered data is not null then put the content in p tag like this

var name = prompt('Whats your name traveler');

if(name !== null)
{
  $('#user').text(name);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p id="user" ></p>

1

solved how to add a users input in javascript into html