javascriptjquerydom

JS DOM equivalent for JQuery append


What is the standard DOM equivalent for JQuery

element.append("<ul><li><a href='url'></li></ul>")?


Solution

  • I think you have to extend the innerHTML property to do this

    element[0].innerHTML += "<ul><li><a href='url'></a></li></ul>";
    

    some explanation:

    Hint: As @dontdownvoteme mentioned this will of course only target the first node of the collection element. But as is the nature of jQuery the collection could contain more entries