• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 954
  • Last Modified:

asp.net c# check box with javascript issue

I'm trying to implement some javascript with a check box showing or not showing a <DIV>  
I'm getting the following error:
Compiler Error Message: CS1012: Too many characters in character literal

The script:
<script type="text/javascript" language="javascript">
    function showMe(it, box) {
        var vis = (box.checked) ? "block" : "none";
        document.getElementById(it).style.display = vis;

Open in new window

 <asp:CheckBox ID="cbGuest1" Text="Guest 1" OnCheckedChanged="showMe('Guest1', this)" runat="server" /> 

Open in new window

I will end up with 6 check boxes total but am trying to test with just this one.
Thanks for any suggestions.
  • 2
1 Solution
Rajar AhmedConsultantCommented:
For javascript use onclick ,
<asp:CheckBox ID="cbGuest1" Text="Guest 1" onclick="showMe('Guest1', this)" runat="server" /> 

Open in new window

javierpdxAuthor Commented:
It worked.  Thanks!
javierpdxAuthor Commented:
It worked great.  Thanks!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now