Jquery error handling options
I want to throw an error message if user doesn't input any value for a particular field. I am using blur event. I don't want to use ALERT function for throwing error messages. What are the other options we have availabl开发者_如何学Ce in jquery for error handling?
Since you're validating a form, I'd strongly suggest you use the jQuery Validate plugin. It is widely used by major sites and is very user-friendly - for example, doesn't show any form errors until they've tried to submit the form, in case they were coming back to fill something in, but after that gives immediate feedback when the field is correct.
What that plugin does to display errors is append them to the page itself. For your own error handling, you can leave placeholder elements on the page, then place messages in them and show()
or hide()
them as necessary.
I use jquery validation plugin
use class requried
It sounds like you're looking for form validation, for which there's a jQuery plugin.
精彩评论