I have a simple var with some strings that I convert to a json object. I would like to have an input field for the persons name and then add the text.
Currently I have this
var text = '{"students":[' +
'{"firstName": "Brendan","lastName":"Skousen" },' +
'{"firstName":"Scooby","lastName":"Doo" },' +
'{"firstName":"Your","lastName":"Mom" }]}';
and I have a var for my input
var first = document.getElementById('first').value;
So I would like to have the var text work like this:
var text = '{"students":[' +
'{"firstName": first,"lastName":"Skousen" },' +
'{"firstName": first,"lastName":"Norman" },' +
'{"firstName": first,"lastName":"Coatney" }]}';
You can see the full code at: http://codepen.io/bskousen/pen/xbPLew