I'm simply trying to edit a div named meta description inside of a div named post by taking the html and creating a textarea with it then plugging it back in. I have it working for the Title, content, and even meta keywords, but for some reason the description's textarea just keeps coming up empty in the end.
//---------------edit meta Description------------
var Description = metaDescription;
Description.show();
//save the html within the div
var ogDescription = "None";
if (metaDescription.html()) {
ogDescription = $(Description).html().trim();
}
console.log('ogDescription = ' + ogDescription);
// create a dynamic textarea
var editDescription = $("<textarea />");
editDescription.val(ogDescription);
console.log('editDescript val after adding === ' + editDescription.val());
console.log('editDescript html after adding === ' + editDescription.html());
editDescription.attr('class', 'editDescription')
.css('height', metaHeight)
.css('width', post.css('width'));
// add the textarea
Description.html("<p>meta Description:</p>");
$(Description).append(editDescription);
//--end edit meta Description
Output
Title = Newly Added Post
Posts.js:79 Content = Testing 1, 2, 3
Posts.js:105 ogDescription = Testing 1,2 and u know 3
Posts.js:110 editDescript val after adding === Testing 1,2 and u know 3
Posts.js:111 editDescript html after adding ===
Posts.js:129 Keywords = none, for, now
Description html after === <p>meta Description:</p><textarea class="editDescription" style="height: 80px; width: 262px;"></textarea>
meta Description:
" – Peavey2787 Sep 19 '15 at 06:21