使用jQuery函数关闭多个DIV元素

Tom*_*ash 0 javascript syntax jquery dom function

我需要一个关闭jQuery的小函数来关闭多个DIV元素,但是我在使用JS语法时遇到了麻烦.

我到目前为止:

function closePanels{
$("#servicesPanel").hide("fast");
$("#portfolioPanel").hide("fast");
$("#contactPanel").hide("fast");
$("#aboutPanel").hide("fast");
};

对我来说听起来很合乎逻辑:这样我想从DOM中的各个点调用函数.我在哪里弄错了?如何编写此功能以便它可以工作?

谢谢.

Noo*_*ilk 6

哦,太近了!

这个:

function closePanels{
Run Code Online (Sandbox Code Playgroud)

需要是:

function closePanels () {
Run Code Online (Sandbox Code Playgroud)

注意添加括号(因为它是一个函数).