Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding img tag to div - and not it's not how to use append()
    primarykey
    data
    text
    <p>I correctly add an img tag with the following code but it only displays as a little box with an X in it on the webpage. To test I added this same img tag right in the webpage. That displays fine. I looked at both img tags in developer tools (PF12), and the tags on the page are the same. What I figure is happening is that in jQuery I'm loading the image tag after all the http requests for content have been scheduled, so I'm getting the tag, but it's too late in the browser's processing to get the source file requested and loaded. I'm trying to load different images on first display of the page (depending on contents of a hidden input field - accessing this and deciding which image is working fine based on a few alerts I've inserted).</p> <p>Here's the code inserting the image (with the decisioning removed while I work out this problem):</p> <pre><code>$(document).ready (function() { $('&lt;img class="rcpt" src="~/Images/MountainCrs_Incline.png" alt="" /&gt;').appendTo('div#Logo'); }); </code></pre> <p>Here's the inserted img tag which only displays the "unresolved reference" box (copied right from the resulting html):</p> <pre><code>&lt;div id="Logo"&gt;&lt;img class="rcpt" alt="" src="~/Images/ChampCrs_Incline.png"&gt;&lt;/div&gt; </code></pre> <p>Here's the img tag I inserted into the native html to verify the img tag is formatted correctly (this one displays fine):</p> <pre><code>&lt;h3&gt;&amp;nbsp;&lt;/h3&gt; &lt;img class="rcpt" alt="" src="/Images/ChampCrs_Incline.png"&gt; &lt;h3&gt;&amp;nbsp;&lt;/h3&gt; </code></pre> <p>If anyone could tell me what's going on and how to fix it I'd much appreciate it. I'm using Visual Studio 11 and IE10 for my testing. Thankx...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload