ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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
تم إضافة السؤال من قبل irfan shaikh , Consultant : Senior Web Designer/Front end Developer , Client : ● Impact Proximity, Dubai ● Cube Solution, Dubai ● WAC, Sharjha ● KIOEC, Kuwait ● IRIS Ltd.
تاريخ النشر: 2013/10/21
Kariem Soudy
من قبل 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>

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟