?
Solved

Inserting Images into Div Tag

Posted on 2013-06-04
5
Medium Priority
?
400 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 1000 total points
ID: 39219396
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…
Suggested Courses

718 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