jQuery - 在特定日期之前显示一个 DIV,在特定日期之后显示另一个 DIV

发布于 2024-10-04 11:06:48 字数 110 浏览 1 评论 0原文

我需要能够在新年之前显示一个 div,在新年之后显示另一个 div - 这是一组特定的表单元素,所以我认为这是最好的方法。

有人能指出我正确的语法方向吗?

任何建议表示赞赏!

I need to be able to show one div before the new year, and another after the new year - it's a set of certain form elements so I think this is the best way to do it.

Can someone point me in the right direction of syntax?

Any advice appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

从此见与不见 2024-10-11 11:06:48
   if (new Date() < new Date(2011,1,1))
       $('#before').show();
   else
       $('#after').show();

如果一开始就将两者隐藏起来。

   if (new Date() < new Date(2011,1,1))
       $('#before').show();
   else
       $('#after').show();

If both are hidden in the beginning.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文