html
<textarea id="gps" name="gps"></textarea>
<button>Click</button>
jquery
$('button').click(function(){
var arrayOfLines = $('#gps').val().split('\n');
$.each(arrayOfLines, function(index, item) {
$this = $(this);
console.log($this);
});
});
I am trying to output each line individually so that I can use them later on but at the moment the above seems to split each line and then place each letter as an object
You are placing a string into a jQuery object. Just use the item
instead:
$('button').click(function(){
var arrayOfLines = $('#gps').val().split('\n');
$.each(arrayOfLines, function(index, item) {
console.log(item);
});
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments