Using '$(this)' In A Function

后端 未结 3 1272
无人及你
无人及你 2020-12-07 00:55

I am creating a menu that opens and closes using jQuery. In simple terms, it works like this:

function open_menu() {
    $(this).next(\'ul.sub-menu\').css(\'         


        
3条回答
  •  太阳男子
    2020-12-07 01:26

    You can use apply to set the value of this in the function.

    open_menu.apply(this)
    

提交回复
热议问题