A web developer's blog. PHP, MySQL, Javascript/jQuery, Zend Framework, Wordpress, Code Igniter, Django, Python, CSS and other web development topics.

jQuery: How to handle radio buttons

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());
            }
        }
    );

Related posts:

  1. Check Multiple Checkboxes in one click using jQuery
  2. Mixing PHP Variables with Javascript (Zend Framework and jQuery)
  3. Handling HTML Checkboxes. Execute something when checked/unchecked.
  4. Zend Framework How To: Handling checkboxes using Zend_Form and jQuery
  5. Zend Framework: View File downloaded as Excel File
This entry was posted in General and tagged , . Bookmark the permalink.

5 Responses to jQuery: How to handle radio buttons

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

  2. 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. Nice post, you got some good points there – thank you.

  4. Musa says:

    if my field name is data[user][myradio], how to handle this?

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Bad Behavior has blocked 635 access attempts in the last 7 days.