How do you detect if an html element can append child nodes?

后端 未结 4 768
感情败类
感情败类 2021-01-11 10:20

I created a custom jquery event called \'loading\' in my application. I want to append a masking element with a spinner, when this event is triggered. I can figure out tha

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-11 11:21

    The accepted answer has a very nice fuction based on which types of nodes can be void. It can be replaced by a jQuery one-liner:

    node.is("area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr")

提交回复
热议问题