将 jquery 元素转换为 html 元素
我有一个 jQuery 元素,但我必须将其发送到仅接受 HTML 元素的函数。如何将 jQuery 元素转换为 HTML 元素?
I have a jQuery element but I have to send it to a function that only accepts HTML elements. How can I convert the jQuery element to an HTML element?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试
myJQueryElement.get(0)
或myJQueryElement[0]
。 (例如,当您需要负索引时,get()
最有用,如get()
文档中所述。)Try
myJQueryElement.get(0)
ormyJQueryElement[0]
. (get()
is most useful when you need negative indices, for example, as described in the documentation forget()
.)$("#foo")[0]
将为您提供一个 HTML 元素。使用括号比使用.get()
快一点,但除非您这样做,否则您可能不会注意到数百万次。$("#foo")[0]
will get you an HTML element. Using brackets is a tiny bit faster than using.get()
but not something you'll likely notice unless you are doing it millions of times.