Can someone please tell me the code where clicking on a link populates a textarea with a little paragraph.

Recommended Answers

All 3 Replies

Unless I'm mistaken (and could be, since I haven't javascripted in a while), doesn't it matter which browser you are doing it for? (like, aren't the DOM's different for IE and mozilla?)

I think the w3c compliant version is:

document.getElementById('textboxnamehere').value="text to display";

Comatose is correct. Here is more detail.

<script type="text/javascript">
function ElementContent(id,content)
{
    document.getElementById(id).value = content;
}
</script>

<textarea id="ta1">&nbsp;</textarea>
<button value="Click Me!" onclick="ElementContent('ta1','Hey, it works.')" />
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.