I'm newbie to jquery.i bind click event to div element which is created dynamiclly. but it can't work.
Anyone could help me? Thank a lot thomas.chen The following is my code! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <head> <title>JQuery</title> <meta http-equiv="Content-Type" content="text/html; charset=GBK" /> <link rel="stylesheet" type="text/css" href="css/default.css" /> <script type="text/javascript" src="javascript/jquery-1.2.3.pack.js"></script> </head> <body><center> <table id='page' width='1024' border='0'> <tr> <td><a href='http://www.jquery.com' target="_blank"><image src='image/jquery_logo.gif' border='0'/></a></td> <td id='title'>JQuery</td> </tr> <tr> <td id='menu'> </td> <td id='content'> </td> </tr> </table> <script lanuage="javascript"> $(document).ready(function(){ $.ajax({url:'jquery/menu.xml' ,type: 'GET' ,dataType: 'xml' ,timeout: 1000 ,error:function(){ $('#menu').text('Menu Loading Error !'); } ,success:function(xml){ var _menu = $('#menu'); $(xml).find('menus').each(function(){ var _ul = $(document.createElement('ul')); var _li = $(document.createElement('li')); _li.css('font-weight','bold'); _li.html($(this).attr('name')); _li.appendTo(_ul); $(this).find('menu').each(function(){ var __li = $(document.createElement('li')); __li.css('padding-left','25px'); __li.html('<div>'+$(this).attr('name')+'</div>'); __li.appendTo(_ul); }); _ul.appendTo(_menu); }); } }); $('#menu div').bind('click',function(){ }); }); </script> </center></body> </html>