如何使用JQuery删除添加的动态控件 [英] How to Delete the added dynamic controls using JQuery

查看:73
本文介绍了如何使用JQuery删除添加的动态控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的代码中,当我点击+按钮时我添加了文本控件。

但是当我点击 - 按钮时同一行没有删除。 。

这是我添加和删除动态控件的编码..

这里添加工作正常...但是删除不起作用..

你能不能帮我删除我添加的特定行...



Hi, In my code I have added the text control when I click on the "+" button.
but the same row is not deleting when I click on the "-" button. .
This is my coding for adding and deleting the dynamic controls..
Here adding is working fine...but deleting is not working..
would you please help me to delete the particular row which I added....

function  OnMpBtnPlus2Click()
       {

            var Parent1Name = $("#txtDPloicyName1").val();
            var Parent1Age = $("#txtDPloicyAge1").val();

            if (Parent1Name == "" || Parent1Name == "Parent Name" || Parent1Name == null || Parent1Age == "" || Parent1Age == null || Parent1Age == "Parent Age") {
                alert("Please enter details");
                return false;
            }
            if (!isNaN(Parent1Name)) {

                $("#lblDError1").text("Please Don't enter Numbers for Name");
                return false;

            }
            else {
                $("#lblDError1").text("");
            }
            if (isNaN(Parent1Age)) {
                $("#lblDError1").text("Please  enter Numbers for Age");
                return false;
            }
            else {
                $("#lblDError1").text("");
            }

            var result_style = document.getElementById('DParent1').style;
            result_style.display = 'table-row';
        }
        function  OnMpBtnMinus2Click()

        {

            var result_style = document.getElementById('DParent1').style;
            result_style.display = 'none';
        }

推荐答案

#txtDPloicyName1)VAL();
var Parent1Age =
("#txtDPloicyName1").val(); var Parent1Age =


#txtDPloicyAge1\" )VAL();

if (Parent1Name == || Parent1Name == 父名 || Parent1Name == < span class =code-keyword> null
|| Parent1Age == | | Parent1Age == null || Parent1Age == Parent年龄){
alert( 请输入详细信息);
return false ;
}
if (!isNaN(Parent1Name)){
("#txtDPloicyAge1").val(); if (Parent1Name == "" || Parent1Name == "Parent Name" || Parent1Name == null || Parent1Age == "" || Parent1Age == null || Parent1Age == "Parent Age") { alert("Please enter details"); return false; } if (!isNaN(Parent1Name)) {


#lblDError1)。text( 请不要为姓名输入数字);
return false ;

}
else {
("#lblDError1").text("Please Don't enter Numbers for Name"); return false; } else {


这篇关于如何使用JQuery删除添加的动态控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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