Category: jquery

Loading a Drop Down List Using jQuery

To load a drop down list (or a simple list) from a database, there are different ways. One is to embed PHP code in the HTML code, that loops through the rows in the database and adds <option> </option> tags.

Form Validation Using Jquery Examples

When you include forms on your website for user input, it is always advisable to perform some validation on the data entered. This not only ensures that your application receives the type of data it can work with, but it also makes for good UX (user experience) as users will be able to be warned of the incorrect input and be given hints of the kind of data that is acceptable.

There are two kinds of validation: client-side and server-side validation. It is recommended that you perform both. Client side validation is usually done with JavaScript and it serves to give the user quick feedback on input errors before a call to the server is made with the data. Server side validation serves as a second line of defence against invalid data. Even if you have set up client side validation, you should always perform server side validation as JavaScript can be bypassed.

In this tutorial, we’ll look at how client side validation can be done using jQuery. We’ll see two ways of doing this. First we’ll validate a form’s data by writing the validation rules from scratch and then in the second example, we’ll show how this process can be made easier by using the jQuery Validation Plugin.

If you want to see how you can validate your form quickly usingthe jQuery Form validation plugging, head straight to The Most Indispensable jQuery Form Validation Reference Guide