Solved

Get checkbox value

Posted on 2014-11-10
1
108 Views
Last Modified: 2014-11-10
How can I return the checkbox value when the checkbox is clicked.
What is wrong with this


    <script type="text/javascript">
     
        function OptionsSelected(e) {
            alert((e.target || e.srcElement).value);
        }
    </script>

<body>
    <input type="checkbox" name="checkgrp" onclick="return OptionsSelected(e)" value="Test_Value" id="Test">Test
 
</body>
0
Comment
Question by:JElster
1 Comment
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
Test page : http://jsfiddle.net/vxkjpkoo/

   <script type="text/javascript">
      
        function OptionsSelected(me) {
            alert(me.value);
        }
    </script>

<body>
    <input type="checkbox" name="checkgrp" onclick="return OptionsSelected(this)" value="Test_Value" id="Test">Test
  
</body>

Open in new window

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now