我有一個復(fù)選框和一個標(biāo)簽,其中一行有一個文本字段。當(dāng)頁面加載時,復(fù)選框被選中,如果用戶取消選中該復(fù)選框,我希望刪除該行。并不是真正的顯示/隱藏,因?yàn)槲也恍枰匦嘛@示未選中的復(fù)選框。有沒有快速的方法來做到這一點(diǎn)?我正在使用 JQuery 添加行,但如果未選中,我想刪除行。我正在使用追加,所以我想我想“前置”或“刪除”添加的復(fù)選框和行。<script>$(document).ready(function(){$("#btn1").click(function(){$("p").append(" <b>Appended text</b>.");});$("#btn2").click(function(){$("ul").append("<li><input type='checkbox' checked> Other Group <select><option>(HG) 1</option><option>(OG) 2</option><option>(OG) 3</option><option>(OG) 4</option><option>(OG) 5</option></select> <input type='text' name='fname' size='30'></li>");});});</script>超文本標(biāo)記語言其他團(tuán)體已選擇<ul><li><input type="checkbox" id="vehicle1" name="vehicle1" value="Bike" checked><label for="vehicle1"> Rock Quarry Worker</label></li></ul><p> </p><style>ul {padding: 0;list-style-type: none;}li { margin: 0 0 4px 0;}</style><p>Availble </p><form> <style> .space {li { margin: 0 0 4px 0;}} </style><input type="checkbox" id="vehicle0" name="vehicle1" value="Bike" class="space"> <label for="vehicle1"> Row Boat Operator</label><br><input type="checkbox" id="vehicle2" name="vehicle2" value="Car" class="space"><label for="vehicle2"> Window Washer</label><br><input type="checkbox" id="vehicle3" name="vehicle3" value="Boat"><label for="vehicle3"> Zoo Keeper</label><br></form><p><button id="btn2" class="btn2">+</button> Add </p><p> </p><style> .btn2 { background-color: red; color:#FFF; font-size: 10pt; font-family:Impact, Haettenschweiler, "Franklin Gothic Bold", "Arial Black", "sans-serif"; padding: 6px; }</style>
- 1 回答
- 0 關(guān)注
- 137 瀏覽
添加回答
舉報
0/150
提交
取消