jquery append div inside div with id and manipulate

后端 未结 4 1002
轻奢々
轻奢々 2021-02-04 00:08

after 2 hours of searching I decided to ask my question.

I have a div:

I want to add a div inside th

4条回答
  •  青春惊慌失措
    2021-02-04 00:41

    Why not go even simpler with either one of these options:

    $("#box").html('
    ');

    Or, if you want to append it to existing content:

    $("#box").append('
    ');

    Note: I put the id="myid" right into the HTML string rather than using separate code to set it.

    Both the .html() and .append() jQuery methods can take a string of HTML so there's no need to use a separate step for creating the objects.

提交回复
热议问题