Youss
Youss

Reputation: 4212

append img after html text

Im trying to append an img right after a piece of text. Im using 'embedly' to load news items, so I have to perform on window load. Its really simple: JsFiddle

I cant figure out why its not working. I have tried many combinations and events(after,Insert etc) nothing seems to work.

Upvotes: 1

Views: 326

Answers (2)

xdazz
xdazz

Reputation: 160833

You should use .after method.

$('.embed').find('.description').after('<img src="http://latitudes.nu/wp-content/themes/theme-framework/framework/media/images/comment_icon.gif" style="width:14px; height:14px; border:none;" />');

A fix to your demo.

But, use setTimeout is not a good idea, you should set the callback option as the plugin provide.

Upvotes: 1

MikkoP
MikkoP

Reputation: 5092

$("#element").append("<img src=\"image\">");

Upvotes: 1

Related Questions