My code works well for a single-lined input into the textbox. For example: name:adam
But what I want is, to grab the name and class when I input data into the textbox. Something like this:
Example:
name:adam
class:8th grade
<script>
function myFunction()
{
var x = document.getElementById("tarea");
document.getElementById("name").value = x.value.substring(5);
}
</script>
And in the HTML section, I have this:
<textarea rows="4" cols="50" id="tarea" onblur="myFunction()"></textarea>
name: <input type="text" id="name"></br>
class: <input type="text" id="class">
you should split your textarea based on newlines. something like
fiddle: http://jsfiddle.net/MVWAD/