Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
275 views
in Technique[技术] by (71.8m points)

js 删除动态创建的模板

<script type="text/templete" id="templete" class="tep">

        <div class="fields fields2 field_del">
            <div class="field">
                <span class="label"><em class="sign">*</em>用户名称</span>
                <input type="text" required class="name" data-error="用户名称不能为空" />
            </div>
            <div class="field">
                <span class="label"><em class="sign">*</em>门牌号</span>
                <input type="number" required class="num" data-error="门牌号不能为空" />
            </div>
            <div class="field">
                <span class="label"><em class="sign">*</em>工程地址</span>
                <input type="text" required class="address_p" data-error="工程地址不能为空" />
            </div>
            <div class="field">
                <span class="label"><em class="sign">*</em>联系人手机</span>
                <input required onblur="checkValue(this.value, isMobile,'请输入正确的手机号码')" class="mobile2"
                    data-error="联系人手机不能为空" />
            </div>
            <div class="field">
                <span class="label"><em class="sign">*</em>身份证号</span>
                <input type="number" required class='card' onblur="isCardNo()" data-error="身份证号不能为空" />
            </div>
            <div class="field">
                <span class="label"><em class="sign">*</em>社会统一信用代码</span>
                <input type="number" required  data-error="社会统一信用代码不能为空" />
            </div>
            <div class="field">
                <span class="label"><em class="sign">*</em>用户表附件上传</span>
                <div class="field3">
                    <div class="gallery">
                        <div class="img-picker">
                            <input class="file" type="file" accept="image/*" required onchange="previewFile(this)"
                                data-error="请上传用户表或产权证">
                            <p class="summ">用户申请表、用户明细表、产权证或营业执照、规划定点图</p>
                        </div>
                    </div>
                </div>
            </div>
            <a href="#" class="del">x</a>
        </div>
        </script>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

针对你的代码,这块代码就是模版内容吗?删除创建的内容,你直接选择器选中需要删除的节点,然后remove就可以了呀


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...