【发布时间】:2015-11-16 15:05:45
【问题描述】:
jQuery 获取值问题。 选择其他选项值时如何获取输入字段?
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<select id="carm3" name="interest">
<option value=""> Dogs</option>
<option value=""> Cats</option>
<option value=""> Rabbits</option>
<option value=" other">other</option>
</select>
<input type="text" name="other_interest" style="display:none" />
<script>
jQuery(document).ready(function() {
jQuery("#carm3").val(3).text(function() {
if (jQuery.inArray(jQuery("other"))){
jQuery('input[name=other_interest]').show();
return false;
}
});
});
【问题讨论】:
-
欢迎来到 SO。也请看this link