奇妙な事態が発生します。私は<h3>
それにテキストを持っています。このテキストを .text() で抽出し、これを a に入れると<textarea>
、テキストが 2 回表示されます。
HTML
<h3 class="profileRightAboutMeText">Heya, this is all the text.</h3>
<textarea class="profileRightAboutMeTextarea"></textarea>
Jクエリ
$(document).on('click','h6.editMyProfileSection', function() {
var originalText = $('h3.profileRightAboutMeText').text();
$('h3.profileRightAboutMeText').fadeOut('fast', function() {
$('textarea.profileRightAboutMeTextarea').text(originalText).fadeIn('fast');
});
alert(originalText);
});
警告と<textarea>
表示の両方で、次のようにテキストが二重に表示されます。
やあ、これはすべてのテキストです。ねえ、これはすべてのテキストです。