jQuery: When getting the value of an element, do I need to declare the variable in document ready?
<p>I'm storing the value of a specific form element as a variable. This same value is used in multiple functions.</p>

<pre><code>function one() {
    var selectedRole = $('#RegistrationRole_ID').val();
}
function two() {
    var selectedRole = $('#RegistrationRole_ID').val();
}
</code></pre>

<p>I'd like to make this a global variable so I don't have to keep selecting it in each of my functions. So my question is, am I able to still get the value correctly if I declare the variable outside of my document ready block?</p>

<pre><code>&lt;select id="RegistrationRole_ID"&gt;
    &lt;option value="1"&gt;one&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>I think I might have answered my own question...it's possible that the value may change from when the document is loaded. Really, what I am trying to do is remove duplicate code, where I get the value of the element multiple times. Do you have a suggestion for this?</p>
