jQuery and selecting a select list item
<p>I am new to jQuery and am having a problem selecting an item in a select list. I have implemented cascading select boxes as show in this <a href="http://jsatt.blogspot.com/2010/01/cascading-select-boxes-using-jquery.html" rel="nofollow">post</a>. Everything is working fine except for setting a default.</p>

<p>The problem is that I need to select one of the child items when the page is first loaded.</p>

<p>Code:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    function cascadeSelect(parent, child, childVal) {
        var childOptions = child.find('option:not(.static)');
        child.data('options', childOptions);

        parent.change(function () {
            childOptions.remove();
            child
                    .append(child.data('options').filter('.sub_' + this.value))
                    .change();
        })

        childOptions.not('.static, .sub_' + parent.val()).remove();

        if (childVal != '') {
            child.find("option[value=" + childVal + "]").attr("selected", "selected");
        }
    }

    $(function () {
        cascadeForm = $('.cascadeTest');
        parentSelect = cascadeForm.find('.parent');
        childSelect = cascadeForm.find('.child');

        cascadeSelect(parentSelect, childSelect, "5");
    });
&lt;/script&gt;
</code></pre>

<p>HTML:</p>

<pre><code>&lt;select class='parent' name='parent' size='10'&gt;
  &lt;option value='1'&gt;Category 1 -&gt;&lt;/option&gt;
  &lt;option value='2'&gt;Category 2 -&gt;&lt;/option&gt;
&lt;/select&gt;
&lt;select class='child' id='child' size='10'&gt;
  &lt;option class='sub_1' value='5'&gt;Custom Subcategory 1.1&lt;/option&gt;
  &lt;option class='sub_1' value='3'&gt;Subcategory 1.1&lt;/option&gt;
  &lt;option class='sub_2' value='4'&gt;Subcategory 2.1&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>The second select list should show up inside the right box but it does not. </p>

<p><img src="http://i.stack.imgur.com/ehz8l.jpg" alt="alt text"></p>

<p>The child.find call is being hit but does not select the item. </p>

<p>What am I doing wrong?</p>
