Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery events for newly created combox from html select
    primarykey
    data
    text
    <p>I need some guidance/advices from someone who has any ideea about custom jquery event. From a html select I tried to create a "combobox" in which user can type a text and options list would be filtered by that typed text. That way, html code for an select like</p> <pre><code>&lt;select name="foo_select" id="foo_id"&gt; &lt;option value="foo_option_value_1"&gt;foo_option_text_1&lt;/option&gt; &lt;option value="foo_option_value_2"&gt;foo_option_text_2&lt;/option&gt; &lt;option value="foo_option_value_3"&gt;foo_option_text_3&lt;/option&gt; &lt;/select&gt; </code></pre> <p>would be replaced with</p> <pre><code>&lt;div class="combo_container" id="foo_select_container" style="position:relative"&gt; &lt;input type="text" class="combo_text" /&gt; &lt;input type="hidden" name="foo_select" id="foo_id" /&gt; &lt;div class="combo_arrow"&gt; &lt;ul style="position:absolute;"&gt; &lt;li id="foo_option_value_1"&gt;foo_option_text_1&lt;/li&gt; &lt;li id="foo_option_value_2"&gt;foo_option_text_2&lt;/li&gt; &lt;li id="foo_option_value_3"&gt;foo_option_text_3&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>So when the user select's a certain "option" from new created "combobox" in the input with class "combo_text" option's text is inserted, and in the hidden input option's id is inserted.</p> <p>Now, all I need to do is to know when user select's an option. Basically what I need to do is to create the equivalent of jQuery( '#foo_id' ).change( function(){ do_someting } ); for my newly created combobox, but I have no ideea where to start.</p> <p>If someone has any ideea I would apreciate.</p> <hr> <p>Update.</p> <p>I mention that I have tried to keep as much as I could the behavior of the html select. The combo box has functionalities like: on <strong>up/down</strong> arrows on focused <strong>combo.text</strong> the user can select a value, and on enter that value is changed, calling the function <strong>Select()</strong> or on escape nothing chages - even if user has selected other values using <strong>up/down</strong> arrows.</p> <p>So I think I need to do something like.. when hidden input <strong>$( '#foo_id' )</strong> is changed <em>do someting</em>, so I need to find out when this input's value is changed.</p> <hr> <p>Thanks..</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