开发者

Convert jquery element to html element

开发者 https://www.devze.com 2023-03-29 07:28 出处:网络
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 t开发者_如何学Goo an HTML element?Try myJQueryElement.get(0) or myJQuer

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 t开发者_如何学Goo an HTML element?


Try myJQueryElement.get(0) or myJQueryElement[0]. (get() is most useful when you need negative indices, for example, as described in the documentation for 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消