Forum : Textarea Validation using Javascript
Brief description  about Online courses   join in Online courses
View Sandhya  Musalkol 's Profile

Textarea Validation using Javascript

Hi,

I am unable to validate my Textarea used in the form to fill up 'Current Address' details.
I am trying to generate an alert when no Address is entered but am unsuccessful.

Thanks.

Regards,
Sandhya Musalkol
Asked by Sandhya Musalkol | Jan 7, 2011 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
Hi Sandhya,

<textarea id="sandhya1" name="sandhya1" > Textarea content </textarea>

just in JS,

var a = document.getElementById('sandhya1');

if(a.value=='')
{
alert("error");
}

thats it.
Jan 9, 2011