By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,818 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,818 IT Pros & Developers. It's quick & easy.

How to do I validate a textarea in a form in javascript

P: 17
Expand|Select|Wrap|Line Numbers
  1. <script>
  2.     function val()
  3.     {
  4.       //ifnewline found or blank raise an alert
  5.     } 
  6.    </script>
  7.    <form>  
  8.    <textarea name = "pt_text" rows = "8" cols = "8" class = "input" WRAP ></textarea>
  9.    <input type=""button" onclick="val();"
  10.     </form>
1 Week Ago #1
Share this Question
Share on Google+
1 Reply


gits
Expert Mod 5K+
P: 5,318
what exactly should it validate for? you can use the

indexOf-method

or

Regular Expression

for that purpose.
1 Week Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.