Solved

Inserting Images into Div Tag

Posted on 2013-06-04
5
391 Views
Last Modified: 2013-06-04
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'/>");
0
Comment
Question by:Ray Turner
5 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39219356
Your quotes are wrong, should be

<div id='photos'>
0
 
LVL 10

Expert Comment

by:Ishaan Rawat
ID: 39219388
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..
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 250 total points
ID: 39219396
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 250 total points
ID: 39219487
Single quotes around attributes are totally valid HTML.
http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2
0
 

Author Closing Comment

by:Ray Turner
ID: 39219847
Thanks!!!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question