<script type="text/javascript"> $(document).ready(function(){ $('input#twoways').click(function() { $('.backs')[ $('input#twoways').is(":checked") ? 'show' : 'hide' ](); }).triggerHandler('click'); }); </script>