Link to home
Start Free TrialLog in
Avatar of RayT
RayTFlag for United States of America

asked on

Inserting Images into Div Tag

Is there a way to use JQuery to insert images into a div tag?
Here’s what I would like the result to look kike:

<div id=’photos’>
<img alt='' src='Photos/Photo1.png' class='Photos_ImagePos'/>
<img alt='' src='Photos/Photo2.png' class='Photos_ImagePos'/>
<img alt='' src='Photos/Photo3.png' class='Photos_ImagePos'/>
</div>

When I try it the images don't appear???

$("#photos").append("<img alt='' src='Photos/Photos1.png' class='Photos_ImagePos'/>");
Avatar of Gary
Gary
Flag of Ireland image

Your quotes are wrong, should be

<div id='photos'>
Actually there should be double quotes in all the areas.. in HTMl..

corrected code...

<div id="photos">
<img alt="" src="Photos/Photo1.png" class="Photos_ImagePos">
<img alt="" src="Photos/Photo2.png" class="Photos_ImagePos">
<img alt="" src="Photos/Photo3.png" class="Photos_ImagePos">
</div>

Open in new window


and then other reason could be you have not linked to jquery..
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RayT

ASKER

Thanks!!!