Results 1 to 2 of 2

Thread: How to check radiobutton list values using javascript?

  1. #1
    Join Date
    Oct 2012

    How to check radiobutton list values using javascript?

    I want to check radiobutton list values using javascript.I have 5 list items in radiobutton list.If we check first item that value is true remaining all are false.and second item we select that is only true remaining all are false .I want output like that .Anybody can give good solution to me.i checked already in google there is so many solutions for 2list items only i tried like that.But it is not working.

    Thanks & Regards

  2. #2
    Join Date
    Nov 2006
    Given all radio buttons in the group share the same name, let's call it myradio. Each radio button is associated with a unique value that identifies the choice your end-user made. Here is the interesting thing: only the value of the selected radio button is sent when the form is submitted to the server. So there is really no need to change the value of the remaining radio buttons.

    In terms of usability, changing the values to true or false will not help you identify which one of those radio buttons were selected by the user.

    If you just want to use the true or false states in your client-side program, you can just look if
    myradio[i].checked is true or false.

    For instance if the first radio button is checked then myradio[0].checked evaluates to true
    while myradio[1].checked, myradio[2].checked , myradio[3].checked, myradio[4].checked all evalute to false

    I hope the approach offered above suits your need.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center