Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery ajax converting form select options
    primarykey
    data
    text
    <p>Banging my head against the wall here. I've got a button opening a dialog box with a form in it. The form is generated via PHP then loaded via ajax as content into the dialog. It all seem to be working except for the selects. The option text is moved outside the option tag.</p> <p>The calling jquery:</p> <pre><code>$.ajax({ type: 'POST', url: '/wizard/basic-info/contact', dataType: 'html', success: function(html) { console.log(html); $('#dialog-form').append(html); $('#dialog-form').dialog("open"); } }); </code></pre> <p>The console.log just inside the success function produces basically:</p> <pre><code>&lt;form action="" method="post" id="contact"&gt; &lt;label&gt;Payment Terms&lt;/label&gt; &lt;select name="payment_terms" id="payment_terms"&gt; &lt;option value="" selected="selected"&gt;&lt;/option&gt; &lt;option value="net15"&gt;Net 15&lt;/option&gt; &lt;option value="net30"&gt;Net 30&lt;/option&gt; &lt;option value="net45"&gt;Net 45&lt;/option&gt; &lt;option value="net60"&gt;Net 60&lt;/option&gt; &lt;option value="cod"&gt;COD&lt;/option&gt; &lt;option value="consignment"&gt;Consignment&lt;/option&gt; &lt;/select&gt; </code></pre> <p></p> <p>But inspecting the DOM of the finished form yeilds:</p> <pre><code>&lt;form action="" method="post" id="contact"&gt; &lt;label&gt;Payment Terms&lt;/label&gt; &lt;select name="payment_terms" id="payment_terms"&gt; &lt;option value="" selected="selected"&gt;&lt;/option&gt; &lt;option value="net15"&gt;&lt;/option&gt;Net 15 &lt;option value="net30"&gt;&lt;/option&gt;Net 30 &lt;option value="net45"&gt;&lt;/option&gt;Net 45 &lt;option value="net60"&gt;&lt;/option&gt;Net 60 &lt;option value="cod"&gt;&lt;/option&gt;COD &lt;option value="consignment"&gt;&lt;/option&gt;Consignment &lt;/select&gt; </code></pre> <p></p> <p>Obviously the text for each option is on the wrong side. Any suggestions?</p> <p>Answered--- Oop, my bad. I coded my custom element view script wrong. I added a trailing slash to the option tag. This:</p> <pre><code>&lt;option value="net15" /&gt;Net 15&lt;/option&gt; </code></pre> <p>Should have been:</p> <pre><code>&lt;option value="net15"&gt;Net 15&lt;/option&gt; </code></pre> <p>My bad, thanks for the help.</p>
    singulars
    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