html - JQuery Putting a header tag inside of a div tag -


attempted attach simple header div element. confused why not working. h1 tag indicates value of loading.

   <div data-role="page" id="addviewtask">     <div id="header" data-role="header" data-theme="a" data-position="fixed">         <div style="text-align:center;margin:20px">             <h2 class="header-font"> page </h2>         </div>     </div>      <div data-role="main" class="ui-content">         <div class="ui-grid-a">             <a href="#" class="ui-btn ui-corner-all ui-shadow">view tasks</a><br>             <a href="#" class="ui-btn ui-corner-all ui-shadow">add task</a><br>         </div>     </div>      <div id="footer" data-theme="a" data-role="footer" data-position="fixed">         <h2>         </h2>     </div> </div>   function addgreeting(){   $temp = $("<h3></h3>");   $temp.append('hello user');   $("#addviewtask:nth-child(2)").append($temp); } 

$("#addviewtask:nth-child(2)").append($temp);

you're selecting #addviewtask second child of parent. if want second child, you'll need "#addviewtask>*:nth-child(2)".


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -