how to add paragraph on top of div content

前端 未结 6 632
清酒与你
清酒与你 2020-12-09 15:28

How can I add multiple paragraph tag, newly tag on top within div container.

6条回答
  •  悲哀的现实
    2020-12-09 16:16

    You may use prepend to add the paragraph at the top of the container:

    // HTML: 

    Lorem ipsum

    $('div').prepend('

    Bla bla bla');

    Update: Regarding your comment about how to fade in the paragraph - use fadeIn:

    $("#pcontainer").prepend($('

    This paragraph was added by jQuery.

    ').fadeIn('slow'));

    A working demo: http://jsbin.com/uneso

提交回复
热议问题