Jquery append() on another line - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:append


Jquery append() on another line

Demo Code

ResultView the demo in separate window

  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from ww  w.  j a  v a2 s.  c om
var content = {};
content.time = "time";
content.message = "message";
$("p").append($("<span/>", {
    class: "time",
    text: content.time
})).append($("<br />")).append($("<span/>", {
    class: "content",
    text: content.message


Related Tutorials