jQuery attr('onclick')

前端 未结 4 2021
Happy的楠姐
Happy的楠姐 2020-12-15 03:45

I\'am trying to change \"onclick\" attribute in jQuery but it doesn\'t change, here is my code:

$(\'#stop\').click(function() {
     $(\'next\').attr(\'oncli         


        
4条回答
  •  清歌不尽
    2020-12-15 04:18

    As @Richard pointed out above, the onClick needs to have a capital 'C'.

    $('#stop').click(function() {
         $('next').attr('onClick','stopMoving()');
    }
    

提交回复
热议问题