running script on load
<p>Someone on SO helped me write this script for a select box which will show hidden rows based on the selected choice in the dropdown</p>

<pre><code>function showNext(opt)  {
    takeAway()
    var optMap={
        "Picked Up":"#pickedup",
        "Bus to alternate":"#altad2,#altad1",
        "Walk to alternate":"#altad2,#altad1",
    }
    $(optMap[opt]).css("display","") ;
}

function takeAway(){
    $("#pickedup,#altad2,#altad1").css("display", "none");
}
</code></pre>

<p>I need something that will work for this to run onload as well so if something is already selected the rows show</p>

<p>Here is the select that would be affected by the script</p>

<pre><code>&lt;tr class="~[evenoddrow]"&gt; 
            &lt;td class="bold"&gt;In the event of early dismissal I would like my child to:&lt;/td&gt;&lt;td id="Emergclose_Action"&gt;~([01]Emergclose_Action)&lt;/td&gt;&lt;td class="gwCen"&gt;&lt;/td&gt;
            &lt;td&gt;&lt;select name="eReg|Emergclose_Action" id="eReg|Emergclose_Action" onChange="showNext(value);"&gt;
                    &lt;option&gt;&lt;/option&gt;&lt;option value="Walk home as normal"&gt;Walk home as normal&lt;/option&gt;&lt;option value="Ride the bus as normal"&gt;Ride the bus as normal&lt;/option&gt;
&lt;option value="Picked Up"&gt;Be picked up immediately after dismissal&lt;/option&gt;&lt;option value="Bus to alternate"&gt;Ride the bus to an alternate address&lt;/option&gt;&lt;option value="Walk to alternate"&gt;Walk to an alternate address&lt;/option&gt;
                &lt;/select&gt;           
            &lt;/td&gt;
        &lt;/tr&gt;
</code></pre>

<p>I tried the following and it did not work.. </p>

<pre><code>function showNext(opt)  {
        takeAway()

      var optMap={
             "Picked Up":"#pickedup",
             "Bus to alternate":"#altad2,#altad1",
             "Walk to alternate":"#altad2,#altad1",
              }
           $(optMap[opt]).css("display","") ;       

}
function takeAway(){
    $("#pickedup,#altad2,#altad1").css("display", "none");
 }
$(function(){
   $('#eReg|Emergclose_Action').trigger('onchange');
});
</code></pre>
