Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How can we set the indeterminate state of checkbox using javascript?

Checkboxes have three state checked, unchecked and indeterminate, first two have default behavior.

user-image
Question ajoutée par irfan shaikh , Consultant : Senior Web Designer/Front end Developer , Client : ● Impact Proximity, Dubai ● Cube Solution, Dubai ● WAC, Sharjha ● KIOEC, Kuwait ● IRIS Ltd.
Date de publication: 2013/10/21
Kariem Soudy
par Kariem Soudy , Web Solutions Consultant , Tatweer Educational Transportation Services Company

try this

 

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js?ver=3.6.1'></script>

 

<input id='chk' type='checkbox' />

 

<script type='text/javascript'>

$(document).ready(function(){

$('#chk').click(function(){

 

if (this.readOnly==true){

this.checked=false;

this.readOnly=false;

}

else if (this.checked==false){

this.indeterminate=true;

this.readOnly=true;

}

 

});

});

</script>

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?