t4thilina
t4thilina

Reputation: 2197

put a value inside to a TextArea in a PHP file

Could someone please let me know the mistake I have done here..

echo '<button onclick="document.getElementById("."formInner".").innerHTML= document.getElementById("."SaveTheForm".").innerHTML"  type="button">Edit the Table</button>';

echo '<textarea  id="formInner"></textarea>';

SaveTheForm is an id of a form.

Upvotes: 0

Views: 111

Answers (3)

user7789076
user7789076

Reputation: 798

Just try this

echo '<form id="SaveTheForm">';
echo '<button onclick="document.getElementById(\'formInner\').innerHTML=document.getElementById(\'SaveTheForm\').innerHTML"  type="button">Edit the Table</button>';

echo '<textarea  id="formInner"></textarea>';
echo '</form>';

Thanks

Upvotes: 2

Bhadra
Bhadra

Reputation: 2104

onclick="document.getElementById(\'formInner\').innerHTML= document.getElementById(\'SaveTheForm\').innerHTML"

sry changed. u need to escape the quotes

Upvotes: 1

Michal Hatak
Michal Hatak

Reputation: 787

check your javascript code,

document.getElementById("."formInner".")

should be

document.getElementById('formInner') // no dots

btw: everytime is better have javascript separate in .js files

Upvotes: 0

Related Questions