Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I access html elements that were dynamically pushed into html?
    primarykey
    data
    text
    <p>I have got a return from a server which is a block of html, which I unfortunately cannot influence. At the moment it is being dumped into my html via AJAX. The problem is that internet explorer doesnt recognize any elements that come through in this block of html </p> <p>eg I cannot:</p> <pre><code>document.getElementById(someValueId) </code></pre> <p>because internet explorer thinks that, in the object explorer, that the div which someValueId is in is empty.</p> <p>Does anyone have any idea how I can actually get to those elements?</p> <p>Edit for some clarity:</p> <p>I actually create a bunch of html elements on the server and push them into a div The entire thing works in firefox, but if I try to run code like </p> <pre><code>&lt;input type="button" onclick="document.form['invoice'].submit value="Confirm" /&gt; </code></pre> <p>The element is not found by Ie. even a default submit input wont work.</p> <p>I inspected the div I populated the data into in Ie and for some obscure reason it thinks that everything I added does not exist at all ( it is literally nowhere in my source ) </p> <p>I tried doing the same thing, but pushed the call into an IFrame, which meant that the code would suddenly start working ( eg I can then submit the form ), but this is causing way too many issues with other parts of the code, so I figure I want to do it properly.</p> <p>Some Example code: This is the form being returned.</p> <pre><code>&lt;form action="orderNew.php?submitOrder=1" method="POST" name="invoice"&gt; &lt;input name="line[181][amount]" id="line[181][amount]" value="" size="10" onchange="isNumeric(this.id)" type="text"&gt; &lt;input name="line[181][itemId]" value="181" type="hidden"&gt; &lt;input type="button" onclick="document.forms['invoice'].submit()" value="Confirm" /&gt; </code></pre> <p></p> <p>isNumeric () calls</p> <pre><code>function isNumeric(elemId){ var numericExpression = /^[0-9]+$/; if(document.getElementById(elemId).value.match(numericExpression)){ return true; } else{ alert('Input not numeric.'); document.getElementById(elemId).focus(); return false; } } </code></pre> <p>isNumeric and Confirm will never fire. They actually fail silently.</p>
    singulars
    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