jQuery选择日期时间属性大于2020年4月1日的时间元素



我的页面有几个<时间日期时间="…">lt/时间>元素。我想使用jQuery来选择那些具有datetime属性granter的元素。我不高兴地使用了下面的脚本。谢谢你的帮助。

$('time[new Date(datetime) > new Date.now()]').click(function(e){...})

您可以使用filter((实现这一点,类似于:

$("time").filter(function() {
return Date.parse($(this).attr("datetime")) > new Date();
})

最新更新