javascript - css not applied to jquery append -
i trying load contents dynamically json file. problem css not applied content. here code:
<div id="main"> <div id="produkter_menu"> <ul id="listcontent"> </ul> </div> <script> $.getjson('js/products.json', function(data) { (i=0; i<4; i++) { for(index in data) { var content1 = new array (object.keys(data[index])[i]); } $("#listcontent").append("<li>" + content1[0] + "</li>"); } } ); </script>
css code:
.produkter_menu ul { margin: 0; padding: 0; width:50%; list-style-type: none; } .produkter_menu ul li { text-decoration: none; color: #000; padding: 25px 11px; background-color: #fff; display:block; border: 1px solid #cacaca; height: 30px; } .produkter_menu ul li a:visited { color: #000; }
the browser displays list items.
one more question: dynamically read contents json file?
thanks help.
html tags using "id" instead "class" atributes, simple alter css selectors example:.produkter_menu ul
#produkter_menu ul
hope helps!!
javascript jquery html css json
No comments:
Post a Comment