jQuery > How to pass the value of a select list to an onclick handler?
<p>I have a button element below that has an onclick handler. Inside the onclick I'm building a dyanamic querystring. 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?</p>

<pre><code>&lt;select id="template"&gt;..select options&lt;/select&gt;

&lt;button 
type="button" 
id="myButton" 
onclick="window.open('&lt;?php echo $thePath ?&gt;/test.php?template=?????', 'popup'); 
return false;"&gt;
click me
&lt;/button&gt;
</code></pre>

<p>I know I can grab the selected option in jQuery with <code>$('#template :selected').val();</code></p>

<p>How can I pass this to the onclick handler?</p>
