Jquery获取web中动态添加的标签id,class

 1 <html xmlns="http://www.w3.org/1999/xhtml">
 2 <head runat="server">
 3     <title>动态获取标签的id,class</title>
 4      <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
 5      <script type="text/javascript">
 6       $(function(){
 7         $("#content").html("<input type='text' name='name' id='name' /> <input type='button' value='用户名' class='btnStyle' />");
 8         $('.btnStyle').live("click",function(){
 9            alert($('#name').val());
10          });
11       });
12     </script>
13 </head>
14 <body>
15     <div id="content">
16      </div>
17 </body>
18 <html>

 

 

posted on 2012-07-10 19:25  风火网络科技  阅读(658)  评论(0)    收藏  举报

导航