Using the Ends With jquery selector and get the options of a listbox
<p>I have the following code:</p>

<pre><code>$("input[id$=UserField_hiddenSpanData],input[title=Title]").each(function(){

    var rb = $('#ctl00_m_g_c6ae303a_6013_4adb_8057_63a214bcfd24_ctl00_ctl04_ctl07_ctl00_ctl00_ctl04_ctl00_ctl00_SelectResult option').length;
    var val = $(this).val();
    if(val != 0 &amp;&amp; val.length != 0 &amp;&amp; rb != 0) { 

        //add one to the counter
        controlsPassed += 1;
    }

    });
</code></pre>

<p>It works fine but I don't want to have the ID hardcoded so I thought I could use</p>

<pre><code>var rb = $('id$=SelectResult option').length;
</code></pre>

<p>but it doesn't work, what's wrong with my syntax?</p>

<p>Thanks in advance.</p>
