I am new to javascript and I have a basic question for a simple task. I am trying to show or hide checkbox when the label is clicked
I am having five Checkbox
How to write a Javascript when Label is clicked five checkbox should display?
Help
Know the answer? Post it. Somebody with the same question will find it here.
Posted Jul 8, 2015, 1:24 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 8, 2015, 1:37 AM EDT
Deepak Ratan175 reputationPosted Jul 8, 2015, 2:10 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 8, 2015, 2:15 AM EDT
Deepak Ratan175 reputationPosted Jul 8, 2015, 2:23 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 8, 2015, 3:09 AM EDT
Deepak Ratan175 reputationPosted Jul 8, 2015, 3:14 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 8, 2015, 3:38 AM EDT
Munesh SharmaRank #174 · 13.9K reputationPosted Jul 8, 2015, 4:13 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jul 8, 2015, 4:33 AM EDT
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="hidecheckboxonlable.aspx.cs" Inherits="hidecheckboxonlable" %>
DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>title>
<script src="https://code.jquery.com/jquery-2.1.4.min.js">script>
<script type="text/javascript">
$(document).ready(function ()
{
$('#lblForshow').hide();
$('#lblForHide').click(function () {
$('.hide').hide();
$('#lblForHide').hide();
$('#lblForshow').show();
});
$('#lblForshow').click(function () {
$('#lblForHide').show();
$('.hide').show();
$('#lblForshow').hide();
});
});
script>
head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="lblForHide" runat="server" Text="Click me for see checkboxed hide">asp:Label><br />
<asp:CheckBox ID="CheckBox1" runat="server" class="hide" Text="AAA" /><br />
<asp:CheckBox ID="CheckBox2" runat="server" class="hide" Text="BBB" /><br />
<asp:CheckBox ID="CheckBox3" runat="server" class="hide" Text="CCC" /><br />
<asp:CheckBox ID="CheckBox4" runat="server" class="hide" Text="DDD" /><br />
<asp:CheckBox ID="CheckBox5" runat="server" class="hide" Text="EEE" /><br />
<asp:Label ID="lblForshow" runat="server" Text="Click me for see checkboxed hide">asp:Label><br />
div>
form>
body>
html>
Rahul PrajapatRank #1,209 · 1.5K reputationPosted Jul 8, 2015, 7:22 PM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Aug 14, 2015, 1:14 AM EDT
Sumit JoshiRank #1,252 · 1.4K reputationPosted Aug 14, 2015, 1:20 AM EDT
<%@ Page Language="C#" AutoEventWireup="true"CodeFile="hidecheckboxonlable.aspx.cs" Inherits="hidecheckboxonlable" %>
DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>title>
<script src="https://code.jquery.com/jquery-2.1.4.min.js">script>
<script type="text/javascript">
$(document).ready(function ()
{
$('#lblForshow').hide();
$('#lblForHide').click(function () {
$('.hide').hide();
$('#lblForHide').hide();
$('#lblForshow').show();
});
$('#lblForshow').click(function () {
$('#lblForHide').show();
$('.hide').show();
$('#lblForshow').hide();
});
});
script>
head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="lblForHide" runat="server" Text="Click me for see checkboxed hide">asp:Label><br />
<asp:CheckBox ID="CheckBox1" runat="server" class="hide" Text="AAA" /><br />
<asp:CheckBox ID="CheckBox2" runat="server" class="hide" Text="BBB" /><br />
<asp:CheckBox ID="CheckBox3" runat="server" class="hide" Text="CCC" /><br />
<asp:CheckBox ID="CheckBox4" runat="server" class="hide" Text="DDD" /><br />
<asp:CheckBox ID="CheckBox5" runat="server" class="hide" Text="EEE" /><br />
<asp:Label ID="lblForshow" runat="server" Text="Click me for see checkboxed hide">asp:Label><br />
div>
form>
body>
html>
If it is helpful for you Accept as answerUpendra Pratap ShahiRank #329 · 7.5K reputationPosted Aug 14, 2015, 2:00 AM EDT
Sumit JoshiRank #1,252 · 1.4K reputationPosted Aug 14, 2015, 2:03 AM EDT
Sumit JoshiRank #1,252 · 1.4K reputationPosted Aug 14, 2015, 2:05 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Aug 14, 2015, 2:16 AM EDT
Sumit JoshiRank #1,252 · 1.4K reputationPosted Aug 14, 2015, 2:17 AM EDT
Put Javascript in
tag insideHTML
type="checkbox" name="cell" id="cell" data-on="Yes" data-off="No" />type="checkbox" name="blackBerry" id= "blackBerry" data-on="Yes" data-off="No" />Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Aug 14, 2015, 2:20 AM EDT
Sumit JoshiRank #1,252 · 1.4K reputationPosted Aug 14, 2015, 2:34 AM EDT
Govinda Rajulu YemineniRank #1,518 · 1K reputationPosted Aug 14, 2015, 3:50 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts