Agree to the relevant terms when not ticked, the login button is gray and cannot be submitted, click the gray Sign-in button to agree to the relevant terms, tick and turn into bright light and can submit information.
check box and text:
1 <div class= "Check-rule" >2 <label>3 <input type= "checkbox" Name = "id=" check "class=" hidden "onchange=" Boxchange (This) ">4 <i class=" Check "></i>5 </label>6 I agree to the relevant terms <span ><font id= "agreerule" color= "Red" size= "3" > </font></span>7 </div>
JS Code button Color Realization:
functionBoxchange (obj) {if($ (obj). Prop ("Checked")){ //Check Action varNewbtn=document.getelementbyid ("Regist"). src= ". /resources/img/regist-btn.png "; $("#regist"). CSS ("Background", ' url (' + newbtn + ') '); $("#agreeRule"). Hide (); }Else{ //Uncheck Action varNewbtn=document.getelementbyid ("Regist"). src= ". /resources/img/regist-btngray1.png "; $("#regist"). CSS ("Background", ' url (' + newbtn + ') '); document.getElementById ("Agreerule"). Innerhtml= "Please agree to the relevant terms"; $("#agreeRule"). Show (); } }
The JS code determines if the checkbox is selected:
function Verify () { var ischeck=$ ("#check"). Get (0). checked; Gets the selected state, which returns TRUE or False if(! Ischeck) { document.getElementById ("Agreerule"). Innerhtml= "Please agree to the relevant terms"; return ; } Else {// Related actions ... }
JavaScript check for checkboxes, error hints and button discoloration actions