jQuery/[removed] Defining a global variable within a function?

后端 未结 3 2155
醉话见心
醉话见心 2021-02-15 11:02

I have this code:

        var one;
        $(\"#ma1\").click(function() {
            var one = 1;
        })
        $(\"body\").click(function() {
                     


        
3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-15 11:51

    If you want to make a global variable bind it to window object

    window.one = 1;
    

提交回复
热议问题