后剩下这是JS我有:清除的DIV的使用从下拉列表中选择的jQuery
<script type="text/javascript">
$(document).ready(function(){
$('#box1').hide();
$('#box2').hide();
$('#box3').hide();
$("#thechoices").change(function(){
if(this.value == 'all'){
$("#boxes").children().show();
}else{
$("#" + this.value).show().siblings().hide();
}
});
$("#thechoices").change();
});
</script>
和HTML:
<div id="boxes">
<div id="box1"><p>Box 1 stuff…</p></div>
<div id="box2"><p>Box 2 stuff…</p></div>
<div id="box3"><p>Box 3 stuff…</p></div>
</div>
我需要从下拉列表中选择后清除(清空)所有其他选项, (即使我打开源代码,他们也不会ap梨),并在同一时间禁用下拉列表,
如何实现?
是否要将它们从页面中完全删除或只是将它们留空。如果你想让它们变为空白,可以这样做: $('#thechoices')。empty(); – iAmClownShoe 2013-03-12 19:13:17
而且,javascript(jquery)无法从源代码中删除元素,只有DOM。见http://stackoverflow.com/questions/2185760/jquery-does-remove-really-remove – 2013-03-12 19:14:33
是的,他是正确的,它不会从源代码删除它,只有dom – iAmClownShoe 2013-03-12 19:16:34