JavaScript Line Breaks in form object line breaks from textarea,line breaks form,line breaks from

Please let me know if this is a duplicate post, but I was not able to find a solution to my issue. Its gotta be something simple...

I'm trying to use javascript to build a form. The html for the form is as follows:

<form>
  Time: <input type="time"> <br>
  Performer: <input type="text"><br>
  Link: <input type="text"><br>
  <input type="submit" value="Submit">
</form>

what I'm trying to do is build this exact form using javascript, but the elements are all showing up on the same line. Here's my javascript function:

function addPerformance(){
var brk = document.createElement("br");
var form = document.createElement("form");

//create time element
var time = document.createElement("input");
time.setAttribute("type", "time");
form.appendChild(time);
form.appendChild(brk);

//create perfomer element
var perf = document.createElement("input");
perf.setAttribute("type", "text");
form.appendChild(perf);
form.appendChild(brk);

//create link element
var link = document.createElement("input");
link.setAttribute("type", "text");
form.appendChild(link);
form.appendChild(brk);

//create submit element
var sub = document.createElement("input");
sub.setAttribute("type", "submit");
sub.setAttribute("value", "Submit");
form.appendChild(sub);
form.appendChild(brk);

document.body.appendChild(form);
}

"form.appendChild(brk)" is what I thought would add those line breaks like in the html example but its not working. Ultimately, I just want each element of the form to be in a single column. Any help would be greatly appreciated, thanks!

Answer:1

I'm trying to send a an array to my sender from my receiver but when I try it it will turn it into a string. I have the code: messageBus = window.castReceiverManager.getCastMessageBus(namespace, ...

I'm trying to send a an array to my sender from my receiver but when I try it it will turn it into a string. I have the code: messageBus = window.castReceiverManager.getCastMessageBus(namespace, ...

  1. chromecast send message
  2. chromecast send message from receiver
  3. chromecast custom receiver send message

What is the difference between (null != someVariable) and (someVariable != null)? I have seen a lot of people using 'null' first in the comparison. Which one is better than the other and why?

What is the difference between (null != someVariable) and (someVariable != null)? I have seen a lot of people using 'null' first in the comparison. Which one is better than the other and why?

This is driving me nuts. I'm getting multiple mouseout events registering even though I'm getting rid of them with removeEventListener(). I've tried all kinds of variations of this. Essentially, once ...

This is driving me nuts. I'm getting multiple mouseout events registering even though I'm getting rid of them with removeEventListener(). I've tried all kinds of variations of this. Essentially, once ...

I wrote the following code. With this code pushing Submit button submits the form manually. I have also a timer which I want to auto submit the form after 10 seconds. But it does not work. It counts ...

I wrote the following code. With this code pushing Submit button submits the form manually. I have also a timer which I want to auto submit the form after 10 seconds. But it does not work. It counts ...

  1. auto submit form on page load
  2. auto submit form javascript
  3. auto submit form php
  4. auto submit form on change
  5. auto submit form after scanning barcode
  6. auto submit form jquery
  7. auto submit form in html
  8. auto submit form after 5 seconds
  9. auto submit form react
  10. auto submit form in jsp
  11. auto submit form angular
  12. auto submit form ajax
  13. auto submit form without javascript
  14. auto submit form after file upload
  15. auto submit form on page load javascript
  16. auto submit form angular 6
  17. auto submit form select change
  18. auto submit form using jsp