Home: htmlArea 3 (beta): htmlArea 2 & 3 archive (read only): htmlArea v3.0 - Discussion:
How to get htmlarea's value within javascript code?



bloodworth
New User

Feb 20, 2005, 5:26 AM


Views: 33252
How to get htmlarea's value within javascript code?

Hi I want to make sure the htmlarea is not empty within js code. (check when submits form). Here is the code I use to submit form:
<form name="frm" ....>
<textarea id="ta" name="ta" cols="10" rows="10"></textarea>
<input type="button" name="btnSubmit" value="Submit" onclick="submit_frm(frm)">
</form>

js code:
function submit_frm(frm)
{
if(frm.ta.value=='')
alert('Please input text');
else
frm.submit();
}


This code works ok before applied HTMLArea, but after I replace textarea with HTMLAlea, the frm.ta.value is alway empty. It seems I need to sync the textarea with htmlarea first? Or is there a way to get htmlarea's value in javascript directly.