Getting the selected text from a select list using jQuery selector
<p>I'm trying to get the selected text from a dropdown using a selector. If I reference the dropdown directly by name it works:</p>

<pre><code>$('#aBigLongASP.NETWebformsGeneratedName_ddl_StateOfOption :selected').text()
</code></pre>

<p>I am however trying to use a selector to select the dropdown using only the last part of the name:</p>

<pre><code>$('#select[id$='ddl_StateOfOption']) :selected).text();
</code></pre>

<p>but I can't quite seem to get it to work. The Chrome developer tool throws the following error:</p>

<blockquote>
  <p>SyntaxError: Unexpected identifier</p>
</blockquote>

<p>Can anyone point out where the error is?</p>
