Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
157
rated 0 times [  162] [ 5]  / answers: 1 / hits: 19895  / 13 Years ago, mon, january 16, 2012, 12:00:00

I know how to create elements with jquery using something like:



$('<div/>').appendTo('body');


How can I create this:



<a href=><img src= /></a>


Using the same technique?


More From » jquery

 Answers
17
$('<img />').attr({
src:'some image url',
width:'width in intiger',
height:'integer'
}).appendTo($('<a />').attr({
href:'somelink'
}).appendTo($('#someElement')));

[#87988] Saturday, January 14, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tonisandyp

Total Points: 694
Total Questions: 97
Total Answers: 77

Location: British Indian Ocean Territory
Member since Tue, Feb 22, 2022
2 Years ago
;