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>