Can't get an array using attribute selectors
<p>I'd like to toggle the visibility of certain rows in a table based on the value of a drop-down box. I already have classes for each of the rows, so I decided to add userType as an attribute (which is generated by PHP) to the <code>&lt;tr&gt;</code>'s. However, when I use the same function I used for toggling the visibility of the rows using their class selectors, it doesn't work with <code>$('tr[userType="User"]');</code>. I've searched around for why this selector isn't returning the right array, but haven't had any luck. Any help would be much appreciated. </p>

<p>Function:</p>

<pre><code>function toggleUserTypeRows(){
    var selected = $('#userTypeDropDown').val();
    switch (selected){
        case 'User':
            var $rows = $('tr[userType="User"]');
            $rows.show();
            $('tr[userType="Admin"]').hide();
            break;

        case 'Admin':
            var $rows = $('tr[userType="Admin"]');
            $rows.show();
            $('tr[userType="User"]').hide();
            break;
        default:
            var $rows = $('#tableUsers tr');
            $rows.show();
    }
}
</code></pre>
