嗨我在div表中有一行如下:
<div class="tbody plb" id="impemail">
<div class="tbc1" style="border-right:none;">
<input class="tblinput sname pvar" type="text">
<input type="hidden" class="ppre" value="">
</div>
<div class="thc2" style=" width: 75%; border-left:1px dotted #CFCFCF;">
<textarea class="tblinput semails txtInputta pvar" style="font-size:13px;"></textarea>
<input type="hidden" class="ppre" value="">
<div class="errmsg emailerr"></div>
</div>
<div class="hideRow" style="width:20px;float:right;padding:15px 0px 0px 0px;">
<img src="../../../images/redcross.png" alt="" />
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
当我点击使用jQuery函数的类"hideRow"时,我尝试编写函数来删除这一行,如下所示,这里我想清除hideRow函数正在进行的输入和textarea字段,以便在刷新页面后值不应该在行中.我试过的jQuery函数如下:
$(function () {
// Delete row from PTC grid
$('.hideRow').live("click", function () {
$(this).parents('.plb').hide("slow", function () {
$(this).parents('.tblinput sname pvar').val('');
$(this).parents('.tblinput semails txtInputta pvar').val('');
});
})
}); …Run Code Online (Sandbox Code Playgroud)