I have this:
$(".nav").after("<a href=\"#\" class=\"lo\">LOGO</a>");
How can I replace the text "LOGO" to my image in an easy way?
I have this:
$(".nav").after("<a href=\"#\" class=\"lo\">LOGO</a>");
How can I replace the text "LOGO" to my image in an easy way?
.after()
method of jquery as you suggested. It can work with HTML objects as well.Example:
var img = $(document.createElement('img'));
img.attr('src', "myimage.jpg");
$(".nav").after(img);
UPDATE with anchor
var img = $('<img />').attr({
src:'myimage.jpg',
width:'50',
height:'10'
});
var anch = $('<a />').attr({
href:'mydomain.com/page.html'
});
img.appendTo(anch);
$(".nav").after(anch);