Jenny Mok Jenny Mok - 24 days ago 14
CSS Question

Appended but style not updating

var dom = '<div data-id="'+id+'" class="box box_album_item"><div class="album_item" style="background: url('+img_src+') no-repeat center center; background-size: cover; height="'+ $('#album_item .album_item:first').outerWidth() +'px"></div></div>';

$('#abc').append(dom);


everything worked, I'm able to see the height in my dom,

enter image description here

but the height is not applied?

Answer

you have mention "height=", you are giving a style not attribute use "height:" instead. var dom = ' ';

$('#abc').append(dom);
Comments