<div class="cards-list">
<input type="text" id="6KfwRH7tWeE8Xcoru" class="card-input inputtitle" placeholder="Card" autocapitalize="none" autocorrect="off" style="background: rgb(255, 255, 224);">
<input type="text" id="3t2KbWkdcssycX4ZA" class="card-input inputtitle" placeholder="Card" autocapitalize="none" autocorrect="off" style="background: rgb(255, 255, 255);">
</div>
<div class="childcards-container">
<div class="cards-list child-cards-list">
<input type="text" id="tR97tczPcrn544xP2" class="form-control card-input childtitle" placeholder="Card" autocapitalize="none" autocorrect="off" style="background: rgb(255, 255, 255);">
<input type="text" id="LLDRn83TquqFz6Z99" class="form-control card-input childtitle" placeholder="Card" autocapitalize="none" autocorrect="off" style="background: rgb(255, 255, 255);">
</div>
<div class="cards-list child-cards-list">
<input type="text" id="a846ePXd64eEgNeva" class="form-control card-input childtitle" placeholder="Card" autocapitalize="none" autocorrect="off" style="background: rgb(255, 255, 255);">
</div>
<div class="cards-list child-cards-list">
<input type="text" id="cTSKTBtmFaikLsayM" class="form-control card-input childtitle" placeholder="Card" autocapitalize="none" autocorrect="off" style="background: rgb(255, 255, 255);">
</div>
</div>
这是我的代码,当我点击.inputtitle
div
.cards-list
时
我想删除.child-cards-list
divs
我正在使用meteor和我的事件处理程序
'click .inputtitle':function(e,tmpl){
$(e.currentTarget).nextAll('.child-cards-list').remove();
},
但它不起作用的其他替代方法是什么?
答案 0 :(得分:1)
这个怎么样:
删除除选定内容之外的所有匹配项:
$(".childtitle").click(function(){
var parent = $(this).parent();
$(".child-cards-list").not(parent).remove();
});
要删除下一次出现:
$(".childtitle").click(function(){
$(this).parent().nextAll(".child-cards-list").remove();
});