Category       
  Server Script
  Client Script
  Data Base
  HTML - CSS
  Third Party
  Mobile Development
  Other
 
 Articles Detail
Posted Date : 2/3/2013     No Of Visit : 521
Introduction : In this article i will show code for check if checkbox is checked using jQuery or validate checkbox is checked or un-checked using jquery.
Other Related Tag
 
In this article i will show code for check if checkbox is checked using jQuery or validate checkbox is checked or un-checked using jquery.

Some of my previous articles are as follows.
Jquery Code to Reset The All Div Control Height by Clicking On It , Jquery Code To Force User Accept Term and Condition , jQuery Mobile Calculator Using Jquery and HTML5, Change Textbox Background And Border Color on Focus,on Blur using jQuery In Asp.net.

So here is the code for this article.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="Fileupload.WebForm3" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Code to check if checkbox is checked using jQuery | Validate checkbox is checked or un-checked</title>
    <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
    <script>
        function ValidateCheckBox() {
            var status = $("#chkvalidate").attr(`checked`);
            if (status == "checked") {
                alert("CHECKED");
            } else {
                alert("UN-CHECKED");
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <p><input type="checkbox" id="chkvalidate" />
    <input type="button" value="Click Me" onclick="javascript:ValidateCheckBox();"/>
    </div>
    </form>
</body>
</html>


Here in this if check box is checked on that case our variable return `checked` other wise we will get `undefined`.


OUTPUT

checkbox

checkbox

Thanks ... :)

 You May Also Like This
 blue arrow  Change Gridview Column Row Color Dynamically Based on Condition in Asp.net Using c#
 blue arrow  C# Code To Insert Word Document Files into SQL Server Database Table Using Asp.net
 blue arrow  Redirection To Login page After Session Time Out In Asp.Net
 blue arrow  Code To Show Microsoft Word Document Content In Browser Using ASP.NET?
 blue arrow  How To Write a Simple Login Page In Asp.net
 blue arrow  Fileupload Control In Asp.net
 blue arrow  Multiple Button Click Event Handeling In MVC3
 blue arrow  Jqiery Datepicker With Default Functionality In Asp.net
 blue arrow  jQuery Code To Resize Div By Cursor Grab Right or Bottom Border in Asp.Net
 blue arrow  Code To Set Gridview Column Width Dynamically Using Asp.net in C#
 blue arrow  How To Get Newly Inserted Record In Sql Server DataBase Using ADO.Net In Asp.Net
 blue arrow  MVC3: How to bind radio button and make single radio button selection in webgrid
 blue arrow  Online Examination With Multiple Choice Questions Using Timer Control In Windows Applications Using C#
 blue arrow  MVC3 CheckBoxList Operations with jQuery
 blue arrow  Code for Paging in Gridview in asp.net Using C#
 User Profile
Name : Vinay Singh
Company Name : -
Blog Name : -
About Me:
 User Comments       
Name : (max 50)
Your Comment : (max 800)
 
Be the first to post comment....
 
Email Id
Password
Forgot Password   |   New Registration
;