【发布时间】:2012-09-13 07:22:58
【问题描述】:
嗨,我的 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>
当我使用 jQuery 函数单击类“hideRow”时,我尝试编写删除该行的函数,如下所示,这里我想在 hideRow 函数运行时清除输入和文本区域字段,以便在刷新后页面中的值不应该在行中。 我试过的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('');
});
})
});
任何人请告诉我如何清除这两个字段,以便在页面重新加载后这些值不应该存在。
【问题讨论】: