I am trying to write a validation script that will look at all the input’s on the page and if the input is empty (value=””), pop up an alert that says which input it is. I feel that I am close, though when I hit submit the alert works but then the form submits anyways. Any help would be great.
If you are testing if a value is empty, null, etc you can simply modify that script, however, i suggest using the jQuery Validation plugin. Also, i once included this within a page (static page) along with the plugin but i dont believe you need it.
Thanks for the quick response! I have used plugins in the past but I really wanted to try and write my own this time. I have messed around with some jQuery before though your script looks very confusing (No Offence), I have never seen jQery.data(……) or typeof before.
This reply has been reported for inappropriate content.
That looks good to my tired eyes, but for one thing you might want to consider — any repeated error messages will continue to regenerate, until you’ve got a huge list on your hands, unless you somehow ensure that only error messages that are currently valid show.
Let me take a look at a validation script I have on hand from an application I worked on awhile back . . .