Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your form is empty when that code executes. Jquery ui dialog will move its entire html structure into its own div (typically at the bottom of the page) with all the applied styling, classes, etc.</p> <p>To see this in jsfiddle, change the code load event to <code>no wrap (head)</code>, it's above the framework select. You will get the error you mention.</p> <p>Use firebug/chrome inspector to look at the html structure at that time. You have:</p> <pre><code>&lt;form name="form1a" method="post" id="form1a"&gt;&lt;/form&gt; &lt;div dialog1&gt;&lt;/div&gt; &lt;div dialog2&gt;&lt;/div&gt; &lt;div overlay&gt;&lt;/div&gt; </code></pre> <p>As a solution to the issue, consider giving the selects their own id's and using: </p> <pre><code>document.getElementById('selectDamage0').options.length = 0; </code></pre> <p>... or continue using the by class name and index, etc instead of using the form notation. </p> <p><strong>Update:</strong></p> <p>Here is a jsfiddle showing another approach, just binding the onchange with jquery and setting the options through that. Commented a bit to show flow -- the function is near the bottom:</p> <p><a href="http://jsfiddle.net/xCMU6/" rel="nofollow">http://jsfiddle.net/xCMU6/</a></p> <p><strong>Update 2:</strong></p> <p>An old way of managing id's at the base level this way is to use a common prefix/suffix. So your first select is <code>type-0</code> with <code>damage-0</code>. Then to reference the other you swap out the words (or split on -).</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.
    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