Have a strange situation happening. I have a <h3> with text in it. When I extract this text with .text() and then put this into a <textarea> the text appears twice.
HTML
<h3 class="profileRightAboutMeText">Heya, this is all the text.</h3>
<textarea class="profileRightAboutMeTextarea"></textarea>
JQUERY
$(document).on('click','h6.editMyProfileSection', function() {
var originalText = $('h3.profileRightAboutMeText').text();
$('h3.profileRightAboutMeText').fadeOut('fast', function() {
$('textarea.profileRightAboutMeTextarea').text(originalText).fadeIn('fast');
});
alert(originalText);
});
Both the alert and <textarea> show the text double as follows:
Heya, this is all the text.Heya, this is all the text.
I would say that you have 2 elements that match $(‘h3.profileRightAboutMeText’) on the page.
You can see here: http://jsfiddle.net/KwcGB/ that the text appears twice because I added an extra h3.profileRightAboutMeText to the html but if the extra line is removed then it only appears once.
Try putting $(‘h3.profileRightAboutMeText’) into the console in firebug and seeing how many elements it matches…