jQuery on绑定事件 报错解决

在学习绑定多个事件时 出现报错

img


附上源代码 希望可以得到解决

        <script>
        $(function(){
            // $("div").on("click",function(){
            //     $(this).css("background","red")
            // })
            $("div").on({
                click:functon(){
                    $(this).css("background","red");
                },
                mouseenter:function(){
                    $(this).css("background","blue")
                },
                mouseleave:function(){
                    $(this).css("background","yellow")
                }
            })
        });
        </script>

click那里是function,你打错了


        <script>
        $(function(){
            // $("div").on("click",function(){
            //     $(this).css("background","red")
            // })
            $("div").on({
                click:function(){
                    $(this).css("background","red");
                },
                mouseenter:function(){
                    $(this).css("background","blue")
                },
                mouseleave:function(){
                    $(this).css("background","yellow")
                }
            })
        });
        </script>
 


Functon错了