jquery中对动态生成的标签响应click事件(二)…与ajax交互使用
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title>Insert title here</title> <link rel="stylesheet" type="text/css" href="../themes/default/easyui.css"/> <link rel="stylesheet" type="text/css" href="../themes/icon.css"/> <script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="../js/jquery.easyui.min.js"></script> <script> jQuery(document).ready(function($) { $('#clickme').bind('click', function() { $.ajax({ async:false, url: "", data: { key: "Delete"}, success: function (data) { $('#divContent').append('<div class="clickyou">Another target</div>'); $('#experimentDialog').dialog('open'); } }); }); $('.clickyou').live('click', function() { alert("Successful click!!"); }); $(function() { $("#experimentDialog").dialog( { bgiframe : false, autoOpen : false, height : 300, width : 400, modal : true, draggable : true }); }); }); </script> </head> <body> <a id="clickme" class="easyui-linkbutton">click me</a> <div id="experimentDialog" title="Jquery" closed="true"> <div id="divContent"></div> </div> </body> </html>