Petros Kyriakou Petros Kyriakou - 1 year ago 70
Javascript Question

Textarea has mysterious whitespace

For some reason the textarea i am appending to using jquery creates white space.


var artistName = $("#artist-name").text();
var songName = $("#song-title").text();
var prepopulated_tweet = "@Myrfriends @RndomPerson \"you'll love this track\" @" + artistName + " - " + songName + " #Rock #Pop #Soul Krilex.******.co/rx11"


<textarea name="name" rows="4" cols="80" id="tweet-message"></textarea>


@Myrfriends @RndomPerson "you'll love this track" @Krilex -

Pieces - Red

#Rock #Pop #Soul Krilex.*****.co/rx11

any clues?

Answer Source

Content in #song-title element must have new lines.


<div id="song-title">
  Pieces - Red

$("#song-title").text(); would return:

  Pieces - Red
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download