0
jQuery出现值问题。 如何在选择选项值other时获取输入字段?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。请查看[此链接](http://meta.stackoverflow.com/questions/5234/how-does-accepting-an-answer-work) – mplungjan