Getting the base element from a jQuery object

后端 未结 4 1607
独厮守ぢ
独厮守ぢ 2020-12-05 01:23

I\'m struggling to find the right terminology here, but if you have jQuery object...

$(\'#MyObject\')

...is it possible to extract the base

4条回答
  •  难免孤独
    2020-12-05 02:01

    $('#MyObject').get(0);
    

    I think that's what you want. I think you can also reference it like a regular array with:

    $('#MyObject')[0];
    

    But I'm not sure if that will always work. Stick with the first syntax.

提交回复
热议问题