1 判断checkbox是否选中 用到 jquery的 is方法
jquery:
$("input[type='checkbox']").attr('value')
返回结果:501
$("input[type='checkbox']").is(':checked')
返回结果:选中=true,未选中=false
js:
if(document.getElementById("checkboxID").checked){
alert("checkbox is checked");
}
引用:https://www.cnblogs.com/qqzy168/archive/2013/03/11/2953492.html
2 js选中
TECHBROOD
HIRO
KANJI
//按值选中
$(".mysel").val('Kanji');
//按文本选中
//$(".mysel").find("option[text='HIRO']").attr("selected",true);
//获取当前选中项的值
console.log($(".mysel").find("option:selected").text());
标签:checkbox,checked,option,text,html,选中,选择器,mysel
来源: https://www.cnblogs.com/init-007/p/11177851.html