码迷,mamicode.com
首页 > Web开发 > 详细

jquery on event

时间:2017-02-28 17:52:40      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:style   body   jquer   not   http   padding   code   jquery   lang   

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>on demo</title>
  <style>
  p {
    background: yellow;
    font-weight: bold;
    cursor: pointer;
    padding: 5px;
  }
  p.over {
    background: #ccc;
  }
  span {
    color: red;
  }
  </style>
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
  
</head>
<body>
 
<p>Click me!</p>
<span></span>
 


 
<table id="table1">
    <tr id="tr1">
    <td>  c 1 </td>
    </tr>
    
    <tr id="tr2">
    <td> c 2 </td>
    </tr>
    
</table>
 
 <table id="table2">
    <tr id="tr1">
    <td>  table 2c 1 </td>
    </tr>
    
    <tr id="tr2">
    <td> table 2c 2 </td>
    </tr>y.fei
    
</table>
 
 
 <script>
  
 var count = 0;
$( "#table2 #tr1 td" ).on( "click", function() {
  $( this ).after( "<p>Another paragraph! " + (++count) + "</p>" );
});

</script>
 
</body>
</html>

 

jquery on event

标签:style   body   jquer   not   http   padding   code   jquery   lang   

原文地址:http://www.cnblogs.com/rojas/p/6479608.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!