jscript and jquery and Uncaught TypeError

jscript and jquery and Uncaught TypeError

本文关键字:and TypeError Uncaught jquery jscript      更新时间:2023-09-26

我有userscript。我最近添加了jquery。

在我添加jquery之前,这行是工作的:

document.getElementById("servertime").removeAttribute("id");

,但现在我添加了jquery (jquery是工作)这行给我的错误,它是未定义的。为什么在使用jquery之前它可以工作,而现在却不行?

这很奇怪,但你现在可以使用jQuery来做到这一点:

$("#servertime").removeAttr("id");