Semantic-UI Popup - Change HTML before initializing

Viewed 686

I'm working with Semantic-UI and have a popup with an input field in it (search field). The popup is initialized/opened "on: 'click'", but I would like to set a value to the input field with javascript before the user opens the popup.

Trying to do so with

document.getElementById("sok_tekst").value = input;

only leads to

Uncaught TypeError: Cannot set property 'value' of null

When I look in the console, I see that the HTML-code contains the popup with the input field (id="sok_tekst"), but it looks like I "can't reach it" with javascript before it's initialized.

I feel I have tried everything, and it looks like I need to open the popup before adding a value to the input field.

Here is a DEMO

Do anyone have a trick up their sleeve for this??

Thanks!

For the curious: I am using the input field as a search field in a table/work plan. When the table is redrawn, by the user changing week number, the popup are redrawn as well. I'm trying to keep the search value, and put it back in the input field, in the new popup, in the new table.

1 Answers
Related