jQuery - getting custom attribute from selected option
<p>Given the following:</p>

<pre><code>&lt;select id="location"&gt;
    &lt;option value="a" myTag="123"&gt;My option&lt;/option&gt;
    &lt;option value="b" myTag="456"&gt;My other option&lt;/option&gt;
&lt;/select&gt;

&lt;input type="hidden" id="setMyTag" /&gt;

&lt;script&gt;
    $(function() {
        $("#location").change(function(){
            var element = $(this);
            var myTag = element.attr("myTag");

            $('#setMyTag').val(myTag);
        });
    });
&lt;/script&gt;
</code></pre>

<p>That does not work...<br>
What do I need to do to get the value of the hidden field updated to the value of myTag when the select is changed.  I'm assuming I need to do something about getting the currently selected value...?</p>
