I have 3 inputs:

```
<input type="text" id="id-1">
<input type="text" id="id-2">
<input type="text" id="id-3">

```

I have a button which calls a function:

```
<button onclick="myfunction()">click me</button>

```

This is the JS-function which gets called, it gets the value of all inputs and displays the whole value in a textarea:

> 
> 
> ```
> function myfunction() {
>   var x =
>   "MyText1: " + document.getElementById("id-1").value +
>   "MyText2: " + document.getElementById("id-2").value +
>   "MyText3: " + document.getElementById("id-1").value;
> 
>   document.getElementById("mytext").innerHTML = x; }
> 
> ```
> 
> 

This is the area where the functions shows the text of the input fields:

```
<textarea id="mytext"></textarea>

```

So far so good. The textarea looks like this:

```
"MyText1: input of id-1" "MyText2: input of id-2" "MyText3: input of id-3"

```

What I want to achieve is the following output:

```
    "MyText1: input of id-1"
    "MyText2: input of id-2"
    "MyText3: input of id-3"

```

My problem is, when I add `document.write("\n");` to the script, the page crashs with following console text: `Uncaught TypeError: Cannot read property 'value' of null`. 

Here a working demo without newline:
<https://jsfiddle.net/6nw8jrk9/>