select下拉框相关操作(更新中。。。)

背景

记录一些关于html标签的操作,基本上都是jquery操作


select下拉框

根据value查找对应option,然后执行选中操作

$("#selectId").find("option[value=" + '"' + selectValue + '"' + "]").attr("selected", 'selected');

查找被选中的option,并执行取消选中操作

$("#selectId").find("option:selected").removeAttr("selected")
原文地址:https://www.cnblogs.com/qingshan-tang/p/12377030.html