Search and Top Navigation
#15351 new bug ()
Opened July 19, 2019 03:08AM UTC
Last modified July 19, 2019 04:10AM UTC
Can't create selectmenu dynamically
| Reported by: | AlfonsoSerra | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | none |
| Component: | ui.selectmenu | Version: | 1.12.1 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
Consider the example in which we create a selectmenu from javascript:
#!text/html
<script type="text/javascript">
var selhtml = `<select id="sel1">
<option value="1">Apples</option>
<option value="2">Orange</option>
<option value="3">Peach</option>
</select>`
var sel = $(selhtml)
var parent = $("div#mysel")
parent.append(sel.selectmenu())
// or
// sel.selectmenu({appendTo: parent})
</script>
This does not work. It wont throw the selectmenu into the dom. This is a problem when a selectmenu is part of a larger javascript component. On this case the parent node may not even exists but we should be able to create the menu in order to attach it at a later point, when the parent is created.
Attachments (0)
Change History (1)
Changed July 19, 2019 04:10AM UTC by comment:1
| description: | Consider the example in which we create a selectmenu from javascript: \ \ \ {{{ \ <script type="text/javascript"> \ \ var selhtml = `<select id="sel1"> \ <option value="1">Apples</option> \ <option value="2">Orange</option> \ <option value="3">Peach</option> \ </select>` \ \ var sel = $(selhtml) \ var parent = $("div#mysel") \ parent.append(sel.selectmenu()) \ // or \ // sel.selectmenu({appendTo: parent}) \ </script> \ }}} \ \ \ This does not work. It wont throw the selectmenu into the dom. This is a problem when a selectmenu is part of a larger javascript component. On this case the parent node may not even exists but we should be able to create the menu in order to attach it at a later point, when the parent is created. \ → Consider the example in which we create a selectmenu from javascript: \ \ \ {{{#!text/html \ <script type="text/javascript"> \ \ var selhtml = `<select id="sel1"> \ <option value="1">Apples</option> \ <option value="2">Orange</option> \ <option value="3">Peach</option> \ </select>` \ \ var sel = $(selhtml) \ var parent = $("div#mysel") \ parent.append(sel.selectmenu()) \ // or \ // sel.selectmenu({appendTo: parent}) \ </script> \ }}} \ \ \ This does not work. It wont throw the selectmenu into the dom. This is a problem when a selectmenu is part of a larger javascript component. On this case the parent node may not even exists but we should be able to create the menu in order to attach it at a later point, when the parent is created. \ |
|---|---|
| summary: | cant create selectmenu dinamically → Can't create selectmenu dynamically |