Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery selectmenu won't initialize after ajax call
    primarykey
    data
    text
    <p>I am using filamentgroup JQuery selectmenu widget. The widget is initialized in page's head section. When the page is loaded for the first time Jquery loads widget successfully but after ajax call (form submit using POST) selectmenu widget stops working (not initializing). I had same problem using input text fields for submitting form on enter key press but then I used delegate method to attach an event handler to selected elements. And it worked. So my question is: how can I reinitialize selectmenu after AJAX call. Maybe I can use same delegate method for initialization. I googled but didn't found any JQuery events that initializes widgets. Here is the code snippet</p> <pre><code>&lt;head&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $('select').selectmenu ({ width: 70, style: 'dropdown', menuWidth: 100, maxHeight: 400, change: function() { $(this).parents('form').submit(); } }); $('body').delegate('.submit', 'keydown', function(e) { if (e.keyCode == 13) { $(this).parents('form').submit(); return false; } }); $('#regFormID').submit(function() { $.ajax( { type: 'POST', url: 'index.php', data: $(this).serialize(), error: function(xml, status, error) { $('#dataFilterID').html('&lt;p&gt;&lt;strong&gt;Error Code:&lt;/strong&gt; '+status+'&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; '+error+'&lt;/p&gt;'); }, success: function(data, textStatus, jqXHR) { $('#dataTableID').html($(data).find('#dataFilterID').html()); } }); return false; } }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="#dataFilterID"&gt; &lt;form id="regFormID" class="reg-form" name="regForm" method="POST" action=""&gt; &lt;select class="select" id="Filter-dbPage-count" name="Filter-dbPage-count"&gt; &lt;option selected="selected" value="30"&gt;30&lt;/option&gt; &lt;option value="50"&gt;50&lt;/option&gt; &lt;option value="100"&gt;100&lt;/option&gt; &lt;option value="150"&gt;150&lt;/option&gt; &lt;option value="200"&gt;200&lt;/option&gt; &lt;/select&gt; &lt;input type="text" value="" class="submit " id="Filter-dbField-1" name="Filter-dbField-1"&gt; &lt;input type="text" value="" class="submit " id="Filter-dbField-2" name="Filter-dbField-2"&gt; &lt;input type="text" value="" class="submit " id="Filter-dbField-3" name="Filter-dbField-3"&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; </code></pre>
    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