javascript - window.load document read does not run -
i have simple html5 page renders table several rows. on 2 of rows gave button want act toggle button show/hide couple of other rows each.
the table rendered intitally rows have function hides 4 columns , sets buttons have correct symbol.
when run page rows visible... window.load function not run. tried document.ready , no joy. toggle buttons once inital click hides rows functions correctly.
my code is...
<script type="text/javascript"> function toggleretail() { if ($('#but_rtoggle').val()=="+"){ $('#but_rtoggle').val("-"); $('#qretail').show("slow"); $('#hretail').show("slow"); } else { $('#but_rtoggle').val("+"); $('#qretail').hide("fast"); $('#hretail').hide("fast"); } } function togglewholesale() { if ($('#but_wtoggle').val() == "+") { $('#but_wtoggle').val("-"); $('#qwholesale').show("slow"); $('#hwholesale').show("slow"); } else { $('#but_wtoggle').val("+"); $('#qwholesale').hide("fast"); $('#hwholesale').hide("fast"); } } $(window).bind("load", function () { $('#but_rtoggle').val("+"); $('#qretail').hide(); $('#hretail').hide(); $('#but_wtoggle').val("+"); $('#qwholesale').hide(); $('#hwholesale').hide(); }); </script>
any appreciated.
make sure jquery script tag before script block.
for loading, of these:
$(document).ready(function(){ //code }); $(function(){ //code }); window.addeventlistener('load', function(){ //code },false);
Comments
Post a Comment