jquery和js 判断下拉框选项选中值
js
<script> var selectId = document.getElementById("VariantType");//获取ID selectId.onchange = function () { var result = selectId.options[selectId.selectedIndex].innerHTML;//获取选中文本 if (result == "Fusion") { //当变异类型的值为Fusion时,变异值为空 $("#Variant").val(""); } } </script>
jquery
$("#VariantType").change(function () { var result = $(this).children('option:selected').val(); if (result == "Fusion") { $("#Variant").val("") } });
本文来自博客园,作者:quitpoison,转载请注明原文链接:https://www.cnblogs.com/quitpoison/p/10674975.html