Reputation: 397
This is part of a simple notepad kind of widget and I am displaying the text on a div, then when I click the div, this should take the text from the div and insert it into a text area which I can then edit and then re-save. I decided to make it a php entry that I can edit/save/paginate. Anyway this is what I have:
The alerts are to track evaluation progress
function editLastDoing() {
var lastentry = $("#home-right-last-doing-tab").text();
alert(lastentry);
$("#home-right-last-doing-tab").text('');
$("textarea#last-doing").val(lastentry);
alert('tried to set text area html');
var currentvalue = $("textarea#last-doing").text();
alert(currentvalue);
document.getElementById('last-doing').style.display = "inline-block";
$("textarea#last-doing").css('display','inline-block');
alert('done');
}
I don't reach "done"
Upvotes: 0
Views: 36
Reputation: 26444
$(document).ready(function() {
$("div").on("click", function() {
$("textarea").text($("div").text());
});
});
http://jsfiddle.net/p4nz5yf5/2/
Upvotes: 1