.html() and .append() without jQuery

前端 未结 6 1959
野趣味
野趣味 2020-12-05 09:34

Can anyone tell me how can I use these two functions without using jQuery?

I am using a pre coded application that I cannot use jQuery in, and I need to take HTML fr

6条回答
  •  温柔的废话
    2020-12-05 10:18

    You can replace

    var content = $("#id").html();
    

    with

    var content = document.getElementById("id").innerHTML;
    

    and

    $("#id").append(element);
    

    with

    document.getElementById("id").appendChild(element);
    

提交回复
热议问题