Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


Best way to validate fields and radio buttons with jquery?


I have several text input fields in my page, and few radio buttons. Now I need to validate them at client side, before I send them to server side (having server side validation too).

I am validating text inputs using jquery and javascript, but now I am wondering is this really the best way to validate them?

And how is this going to work with radio buttons?

$('form').submit(function() {
    validateForm($(this))
    return false;
});

function validateForm(form) {
    var FirstName=form.find('[name=FirstName]').val();
    if (!FirstName) {
        alert('Etunimi puuttuu');
        return false;
    }
}

asked May 8, 2015 in JAVASCRIPT by rajesh
0 votes
6 views



Related Hot Questions



Government Jobs Opening


...