Prefilling a textarea with data pulled from a DB.
<textarea name="body" id="body" rows="5" cols="70"><? echo $body; ?></textarea>
I have a clear button to make it easier for the user to wipe a large chunk of text without having to highlight and delete.
The button uses an onclick="clear();"
function call.
Here is the function...
function clear() {
$('#body').val('');
}
The problem is it wont clear the predefined text. It will only clear text typed in addition to the predefined text. Or if I manually remove the predefined text it works fine.
I need the field to show the value from the DB. Is there a way to accomplish this without echoing the DB value in a <div>
above the field and refraining from pre-defining the ext in the textarea?
Thanks.