jquery - How can i set the text of a div dyanmically? -
i have static html
<div id="myordersdiv"> <ul> <li class="myorderhead"><h5>my orders <i>2</i></h5></li> </ul> </div>
here orders <i>2</i>
represents number of orders present in
how can set text hardcoded 2 dynamically ??
var dataa = '<div id="ordersdiv" style="display:none"></div>'; $("#myordersdiv ul").append(dataa); $("#ordersdiv").prepend(buildcart); $("#myordersdiv").show();
this html
<div id="myordersdiv"> <ul> <li class="myorderhead"><h5>my orders <i>2</i></h5></li> </ul> </div>
and calculating length way
var dataa = '<div id="ordersdiv" style="display:none"></div>'; $("#myordersdiv ul").append(dataa); $("#ordersdiv").prepend(buildcart); var n = $("#ordersdiv").length; $("#myordersdiv").find("i").text(n).show(); $("#myordersdiv").show();
but length being shown 1 .
Comments
Post a Comment