Getting the values of checkboxlist

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mathewgk80
    New Member
    • Sep 2007
    • 103

    Getting the values of checkboxlist

    Hi all,

    I have a checkboxlist with 4 list items A,B,C,D. i would like to get the javascrit code which retrieve values from the checkboxlist if the items are checked..
    ie, if i check the list item A and click on a Button i need to get the alert message "Item A".

    Please help me...


    Thanks and Regards,

    Mathew.
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    Moving to Javascript forum.

    Comment

    • iam_clint
      Recognized Expert Top Contributor
      • Jul 2006
      • 1207

      #3
      in javascript you can get the elements by their name/id/tag

      Code:
      alert(document.getElementById("checkboxid").value); //returns value from that ID
      alert(document.getElementsByName("checkboxname")[0].value); //returns first instance of checkboxname's value
      alert(document.getElementsByTagName("input")[0].value); //returns first input value

      Comment

      Working...