I have a button element below in which I need to make the “template” variable dynamic to match the val() property of the currently selected item in the “template” select menu. How can I do this?
<select id="template">..select options</select>
<button
type="button"
id="myButton"
onclick="window.open('<?php echo $ thePath ?>/test.php?template=?????', 'popup');
return false;">
click me
</button>
I know I can grab the selected option in jQuery with $ (‘#template :selected’).val();
How can I pass this to the onclick handler?