I have a kendo template named editor_template and have a <select>
element inside the template. The <select>
is a drop down and could have any number of items of any kinds of names based on what info we pull from the user. So I am trying to find a way to insert <option>
elements into the select, but so far had no luck.
I have tried things like:
$($('#editor_template').html()).find('#dropdownId').html().replace('variable', optionList);
which would grab my <select>
element, and replace the variable, but no change was reflected in editor_template.
I also tried going after the .innerHTML
instead of html()
too with no luck.
Simply doing:
$('#editor_template').html().replace('variable', optionList);
didn't do anything.
I have <select>variable</select>
, so replace on the variable should do it, but it doesn't replace anything.
How might get this <select>
that is already stated in the kendo template specifically, then insert any number of options that I dynamically acquire into the dropdown?
I don't see that .replace() is a jQuery function and I'm unclear what 'variable' selector is...
Assuming dropdownID is the ID for your <select>
tag and optionList contains HTML, try $('#editor_template').find('#dropdownId').html(optionList);