eKini: Web Developer Blog

PHP, MySQL, Javascript, MVC, Zend Framework, AJAX, jQuery

jQuery: How to handle radio buttons

July3

Here is a quick tutorial on how to handle radion buttons using jQuery.

< input type="radio" name="empType" value="regular" /> Regular
< input type="radio" name="empType" value="temporary" /> Temporary

Then the jQuery code: (assuming that you have already included the JS file in the header…)

 $("input[@name='empType']").change(
        function() {
            if ($("input[@name='empType']:checked").val()) {
                alert($("input[@name='empType']:checked").val());
            }
        }
    );
posted under General
3 Comments to

“jQuery: How to handle radio buttons”

  1. On July 12th, 2008 at 9:55 pm Psychic Advice Says:

    Too bad i didnt come across this blog before. Great stuff you got here. Thanks.

  2. On July 14th, 2008 at 6:24 am Alex Says:

    Hey I just wanted to tell about my website, UptMon.
    It’s a tool for monitoring up- and response time for everything from websites to voice-over-IP services.
    The user can choose to receive reports in case of failures, and much more!

    The address is: http://uptmon.sytes.net

    And it’s completely free!

    //Alex

  3. On July 20th, 2008 at 3:51 am Import from China Says:

    Nice post, you got some good points there - thank you.

Email will not be published

Website example

Your Comment: