Odd jquery behaviour when moving text between fields

I have 2 textboxes, the first has an id of storytxt and the second textbox is dynamically generated in js.

In the second textbox I am setting the value like so

value=" + $('#storytxt').val() + "

When I type into #storytxt text box, and I run the script all works great until I use any white space. The outputs are:

Single words:

<input class="story" id="q1" type="text" value="Test">

Multiple words:

<input class="story" id="q3" type="text" value="Test" this="">

Desired outcome:

<input class="story" id="q3" type="text" value="Test this">

I can’t workout why jquery is parsing the text the way it is, unless .val on a text object doesn’t like whitespace or is it an encoding issue?