How to validate the radio button and checkbox?

Posted by xasjaiod123 on Stack Overflow See other posts from Stack Overflow or by xasjaiod123
Published on 2010-12-21T14:43:02Z Indexed on 2010/12/21 14:54 UTC
Read the original article Hit count: 132

Filed under:
|

For radio button:

$(document).ready(function() {
        $('#select-number').click(function() {
                if ($('input:radio', this).is(':checked')) {
                    return true;
                } else {
                    alert('Please select something!');
                    return false;
            }
        });

    });

It is working fine when no radio button is selected. But When I select the radio button and submit the form Then also it is giving me the alert message 'Please select something!' Is there any good tutorials available for validation using Jquery for newbie.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about validation