programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Website by URL, How to Play YouTube Videos in by using Jquery , Jquery Change div background on mouseover in , JQuery UI Datepicker (Calendar) etc.

Thursday, July 31, 2014

Validation checkbox control using JavaScript:

Validation control using JavaScript: 

In we can Access web controls by using JavaScript language in client site. Then we check validation of each control.Remember that we can easily Access only those controls which make our own html tag at using time. 

Check box validation (E
nable check box using 


For validate check box by JavaScript we use a script function, this is

      function validate(chkbox)
        if (chkbox.checked == 1)
            alert("you are select given check box");
            alert("you are not select given check box......")

In this function we pass check box control as argument in this function.
Then use conditional statement for check that checks box is checked or not
According to the condition gives alert message with in the if and else condition.

And On web page we take one html button and one html checkbox control.
Button control use to call JavaScript validation function on client site.

Html check box Declaration:

<input type=checkbox name=chkbox style="height: 22px; width: 25px"/>select this box(checked)</p>
in the html language it must that you define which type of input you want. For this define


Html button Declaration:

<input type=button value="check" onclick="return validate(chkbox);"
        style="width: 106px; height: 39px"/></p>

Use this check box and button control we make a web page and see the Example of html checkbox.

Example of Check box validation:

<html xmlns="">
<script type="text/javascript">
    function validate(chk) {
        if (chk.checked == 1)
            alert("you are checked");
            alert("can i Checked......")
        chk.checked = 1;
<div align="center">
<h1>Checkbox Validation using JavaScript</h1></div>
<div align="center" style="font-size: x-large">
<form runat="server">
<input type=checkbox name=chkbox style="height: 22px; width: 25px">select this box(checked)
<p><input type=button value="check" onclick="return validate(chkbox);"
        style="width: 106px; height: 39px"></div>
javascript checkbox example onclick,
                               javascript checkbox example onclick,

Other Java Script Related Post :

No comments:

Post a Comment