zoukankan      html  css  js  c++  java
  • Juery添加删除div或span问题

    pageload和每次的触发事件都得bind事件Listener
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="bind事件.aspx.cs" Inherits="bind事件" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script src="include/jquery-1.6.2.min.js" type="text/javascript"></script>
        <script language="javascript" type="text/javascript">
            $(function () {
                bindlister();

                $(".yushe span").click(function () {
                    $(".bbb").append("<span>" + $(this).text() + "</span>");
                    bindlister();
                });
            })
            function bindlister() {
                $(".bbb span").unbind().click(function () {
                    $(this).remove();
                });
            }
        </script>
          <style>
            .aaa{border:1px solid #e4e4e4;200px;height:50px;background-color:Red;padding:5px;}
            .bbb>span{border:1px solid #green;200px;height:50px;background-color:Red;padding:5px;}
        </style>
    </head>
    <body>
        <div class="bbb">
            <span class="aaa">内置标签</span>
        </div>
         <div class="yushe">
            <span>A</span><span>B</span><span>C</span>
         </div>
        <input type="text" name="a" id="a" onblur="checkForm();" />
    </body>
    </html>

  • 相关阅读:
    js 几个特殊情况
    Oracle 常用操作
    SqlServer性能检测和优化工具使用详细
    Fiddler
    JMeter性能测试,完整入门篇
    asp.net缓存
    Quartz.net开源作业调度框架使用详解
    SQL 存储过程
    .net 分布式锁
    全国省市区数据库
  • 原文地址:https://www.cnblogs.com/zpc870921/p/2640547.html
Copyright © 2011-2022 走看看