html

I’m not going to write the style here.

After copying the code, you need to manually add a background box to the. Red-checkbox.

And then I’m going to add a checkable background box to dot active which is a checkable box.

The idea is to change the style of a class by adding the.active name to it with JS

<div class="protocol reg1"> <p id="notSelProtoError" class="error_msg"> < SPAN class="msgIcon"></span> Please check protocol </p> <span < span style =" box-sizing: border-box; color: RGB (51, 51, 51); line-height: 22px; white-space: normal; background-color: RGB (255,255,255); Href =" href "> </a>&amp; <a target="_blank" href=" _blank" > <a > </div>Copy the code

Js 

The explanation is very detailed

Var nav= document.getelementById ("isSelProto"); function xy() {var nav= document.getelementById ("isSelProto"); nav.className = isSelProto.className=="red-checkbox"?" red-checkbox active":"red-checkbox"; } function js_method() {// if(isselproto.className =='red-checkbox ') {// If (isselproto.classname =='red-checkbox ') {// If (isselproto.classname =='red-checkbox ') Active '){window.location.href=" hop link "; }else{document.getelementById ("notSelProtoError").style.display = 'block'; Id =notSelProtoError = block}}Copy the code