如何检查动态删除选项的限制条件? [英] How to check the limit condition for dynamic remove option?

查看:95
本文介绍了如何检查动态删除选项的限制条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



感谢您的时间,



i需要帮助,现在我正在创建div (带控件)动态,我也有删除选项,所以即时创建动态删除选项(只是链接)。



现在我想检查条件,用户不能删除每个div,限制是3次,并且还需要设置警报消息,如果他们达到限制。请找到我的代码下面



html

=====

 <   div     class   =  span3   样式  =  margin- removed270px >  <   a     href   = #x    id   =  removelink > 删除<   / a  >  <   / div  >  





脚本

=======

< script type =   text / javascript> 
$( .form-horizo​​ntal)。delegate( #removelink 点击 function (){
$( this )。最近的(' 。optiondiv')。hide(' slow' function (){
$( this )。remove();
resequence();
});
});
< / script>



请帮我解决这个问题。



谢谢: )

解决方案

。form-horizo​​ntal).delegate( #removelink 点击 function (){


this )。nearest(' 。optiondiv').hide(' slow' function (){


this )。remove();
resequence();
});
});
< / script>



请帮我解决这个问题。



谢谢: )


Hi friends,

Thanks for your time,

i need help, now im creating div(with controls) dynamically, and also i have remove option for that, so im creating dynamically remove option(just link) also.

now i want to check condition like, user cannot remove every div,limit is 3 times, and also need to set alert message if they reach limit. pls find below my code

html
=====

<div class="span3" style="margin-removed270px"><a href="#x" id="removelink">Remove</a></div>



script
=======

<script type="text/javascript">
$(".form-horizontal").delegate("#removelink", "click", function () {
    $(this).closest('.optiondiv').hide('slow', function(){
        $(this).remove();
        resequence();
        });
    });
</script>


pls help me to solve this problem.

thanks :)

解决方案

(".form-horizontal").delegate("#removelink", "click", function () {


(this).closest('.optiondiv').hide('slow', function(){


(this).remove(); resequence(); }); }); </script>


pls help me to solve this problem.

thanks :)


这篇关于如何检查动态删除选项的限制条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆