How to get nodeType using jquery

前端 未结 5 1440
借酒劲吻你
借酒劲吻你 2021-01-13 02:52

I want to get nodeType and then compare it to where it is text node or element node.





        
5条回答
  •  醉话见心
    2021-01-13 03:33

    As noted above, $('.jj').get(0).nodeType works.

    Same as $('.jj').first().nodeType

    or $('.jj').prop('nodeType')

    .prop() : Get the value of a property for the first element in the set of matched elements or set one or more properties for every matched element.

提交回复
热议问题