0

I need some javascript code to validate a select option. Means something like this. Select Country : --select-- If the user submits the form without selecting country. we have to make a alert him saying
"please select the country".
Let me know how to do this and any sample code appreciatable
Thanks in Advance,
Laxman Chowdary

3
  • Please check this URL--> ozzu.com/programming-forum/validate-form-onchange-t18556.html Commented May 7, 2012 at 6:58
  • That url info is not related to my requirement. Once the user doesn't select the select option and form submitting only we have to alert him.. Commented May 7, 2012 at 7:17
  • sorry for the inconvenience. I actually sent the same code to my friend and asked here. But not edited.That is the problem. Once again sorry for that.. Commented May 7, 2012 at 7:22

2 Answers 2

1

By keeping

value=""

of the property you can validate it..

Sign up to request clarification or add additional context in comments.

Comments

0

try onClick event of jQuery, and just add an alert first for you to see how it works whenever that dropdown is being clicked.

1 Comment

Hi bunsichi, I need to work on struts1.3.8 and html with javascript.I'm not aware of Jquery. so kindly tell me in javascript.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.