Create DOM element from jQuery selector

后端 未结 4 2055
野性不改
野性不改 2021-01-13 08:48

I was wondering if it were possible to, instead of selecting an element from the DOM via a jQuery selector, if I can create one instead.

For example:



        
4条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-13 09:25

    I actually created one earlier, still a little buggy, but would work for the case you are thinking of, just using it like

    $.jseldom('#test.a.b')
    

    and you can even use it with sibling selector

    $.jseldom('#test #abc .child +.sibling-of-child')
    

    https://github.com/shekhei/jseldom

    use it if you find it useful, and report all the issues there :P I am really hoping to make it into something that would benefit people :)

提交回复
热议问题