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

js bind

时间:2018-04-27 22:11:50      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:append   nbsp   round   bsp   class   charset   html   tin   pre   


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="div1">
</div>
<div id="div2">tinajia</div>
   <ul id="ul">
       <li>111</li>
       <li>222</li>
       <li>333</li>
       <li>444</li>
  </ul>
</body>
<script src="jquery-3.3.1.js"></script>
<script>
       $(#ul).on(click,li,function () {
         alert($(this).html())

    })
//    function fuc() {
//       alert(1234)
//
//    }

    // $(‘li‘).click(function () {
    //     alert($(this).html())
    // })



    $(#div2).click(function () {
    var b=document.createElement(li)
         b.innerHTML=555
    $(ul).append(b)
});

</script>
</html>

 

js bind

标签:append   nbsp   round   bsp   class   charset   html   tin   pre   

原文地址:https://www.cnblogs.com/liweiblog/p/8964707.html

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