Solved

Inserting Images into Div Tag

Posted on 2013-06-04
5
389 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
Comment Utility
Your quotes are wrong, should be

<div id='photos'>
0
 
LVL 9

Expert Comment

by:Ishaan Rawat
Comment Utility
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
Comment Utility
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 250 total points
Comment Utility
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
Comment Utility
Thanks!!!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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 …
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…
The viewer will learn how to dynamically set the form action using jQuery.
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)

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now