Solved

Get checkbox value

Posted on 2014-11-10
1
113 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40432941
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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-…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

724 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