📅  最后修改于: 2022-03-11 15:04:13.140000             🧑  作者: Mango
//FOR CHECK BOX / SWITCH
var stateValue = $("#yourInputElement").is(":checked");
// will be set to the element value if checked (ON) or will be null otherwise
var stateValue = $("#yourInputElement").is(":checked") ? $("#yourInputElement").val() : null;
//FOR RADIO
var stateValue = $(":radio:checked", radioParentContainer).val();