One of the things we’re going to do today is assign a value to the input form when the checkbox is checked, and clear the form value when the checkbox is checked.
The effect is as follows: Implementation source code: cyfID for the check box id
$("#cyfID").click(function(){
var ischeck=$(this).attr("checked");
if(ischeck==undefined){
//Clear the input box
alert("");
}else{
//Assign a value to the input field
alert("qq");
}
});
$(this).attr(“checked”) is checked and undefined when checked.