jquery - How can I modify with css an image appended with javascript? -
i have appended image javascript using function looked this:
function show_image(src) { var img = document.createelement("img"); img.src = src; document.body.appendchild(img); }
now when try modify style in css:
img{ //style attributes etc. }
the picture not react. how can fix this?
changing css in javascript solution:
add css in function:
function show_image(src) { var img = document.createelement("img"); img.src = src; document.body.appendchild(img); $(document).find(img).css(here add styles); }
example : $(your element).css("color", "red");
Comments
Post a Comment