Helping ordinary people create extraordinary websites!
SIGNUP
LOGIN
HOME
ARTICLES
TUTORIALS
SCRIPTS
ANSWERS
ONLINE SERVICES
TOOLS
FORUM
Get Answers
»
Computer Programming Help
»
JavaScript Help
How can I disable my submit button if the textarea in my form is empty?
Thursday, 17th September 2009
by
Texas
I want to somewhat prevent users from submitting a form if they have not entered any text in the textarea by disabling the submit button using JavaScript.
Tweet
Ask a Question
Save
Watch
tiru_pelli
<html>
<head>
<script type="text/javascript">
function disable()
{
if(document.textArea.text.value=="")
{
document.textArea.submit.disabled=true;
}
else
{
document.textArea.submit.disabled=false;
}
}
</script>
</head>
<body onload="javascript:disable();">
<form name="textArea">
<textarea name="text" rows="2" cols="10" onkeypress="javascript:disable();"></textarea>
<input type="submit" name="submit">
</form>
</body>
</html>
Friday, 18th September 2009
Votes:
40
17
More JavaScript Help:
»
How can I automatically submit a form using JavaScript?
»
Write a javascript code that verifies all textboxes has been filled.
»
How to create a Facebook like popop that shows an animation then the content?
»
How to send post data to the server without loading a new page?
»
How to enable and check if JavaScript enabled?
»
How to use Javascript to produce a dynamic population clock?
»
Moving the content of a div to another div
»
How can I create Facebook applications?
GET OUR NEWS
Connect With Us
Online Services
Domain Names
Hard Drive Recovery
Internet Marketing
Online Backup
Online Training
Payment Processing
SaaS
Software Escrow
Web Design
Web Development
Web Hosting Directory
Developer Resources
Tutorial Directory
Learn HTML
Learn PHP
Learn CSS
Learn AJAX
Learn JavaScript
Learn Pear
White Papers
Resources
Webmaster News
Developer Content