的開始切換與「年齡」任何的div爲了使div
元素自毀,當你點擊它們,你可以做到以下幾點:
// Inside the #container, when somebody clicks a div
$("#container").on("click", "div", function(){
// Remove that div
$(this).remove();
});
至於那切換每個組的知名度複選框:
// When somebody clicks on a checkbox
$(":checkbox").on("click", function(){
// Reference for the checkbox, its name, and checked property (true|false)
var chbx = $(this),
name = chbx.attr("name"),
show = chbx.prop("checked");
// Find elements whose id begins with the checkbox name
// and set their toggle to true or false
$("[id^=" + name + "]").toggle(show);
});
看到它在這裏行動:http://jsfiddle.net/6GBpW/3/
你的複選框在哪裏?我們也應該爲你做這個嗎? – j08691
它也可以幫助你接受回答你問題的人的答案。 – JasCav