Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用Materialize库,我正在尝试从开关组件on中检索值,但无论它是打开还是关闭,它都会返回。
on
有没有办法以编程方式确定它是打开还是关闭?
您必须使用 .checked 例如:Javascript:
document.getElementById('mySwitch').checked
查询:
$('#mySwitch').prop('checked')
我希望我能帮助你。