jQuery $(“body”).height() returns undefined

前端 未结 2 1230
孤独总比滥情好
孤独总比滥情好 2021-01-18 23:29

I have a call like this:

$(\"#ContextMenuModal\").height($(\"body\").height());

However $(\"body\").height() returns undefined

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-19 00:04

    Use this-

     $("body").css("height")
    

    well i will say jquery is not needed-

    this.style.height;//it will not work if you add it as inline js.
    

提交回复
热议问题