I am dynamically setting an option set to a certain value when the page loads. How would I check for that value on the load of the page and then change another divs contents? My best guess is below, but I’ve had no luck.
$("select[name=mySelections]").onload.function() {
if ($(this).find("option:selected").val() == 'myvalue') {
$("#myDiv").html("Test");
}
}
My Selector
{html_options name="mySelections" options=$myOptions selected=$test->One}
My html
<div id="myDiv"
{foreach from $whatever to $this}
<input type="checkbox" name="{$this->Name}" value="{$this->value}" />
{/foreach
</div>
Looks like you’re trying to check if the HTML select element is loaded, but you should check if the DOM is loaded instead, like this: