Radio Buttons - Working Only After Page Refresh (F5)

Radio Buttons - Working Only After Page Refresh (F5)

Hello,

i am am jquery newbie.
i try to showing module methods with radio buttons and hidden div´s. ( for Prestashop )
I have this little Script:


<script type="text/javascript">
{literal}
$(document).ready(function()
{
$("#payment").change(function() 
{
if ($("#bankwire").attr("checked")) {
$("#payment_bankwire").show();
} else {
$("#payment_bankwire").hide();
}
if ($("#paypal").attr("checked")) {
$("#payment_paypal").show();
} else {
$("#payment_paypal").hide();
}
if ($("#nachnahme").attr("checked")) {
$("#payment_nachnahme").show();
} else {
$("#payment_nachnahme").hide();
}
});
});
{/literal}
</script>

On the first time on select or click the readio buttons the Div´s not showing . If  refresh the page (F5)  the script working fine. But why not on first time? What is my failure? Here also the script for the div´s:


<form id="payment" >
{$HOOK_PAYMENT}
<br />
<div id="payment_bankwire">
<input type="button" id="submit" class="exclusive_large" value="weiter zur Schritt 2" onClick="location.href='{$base_dir_ssl}modules/bankwire/payment.php'" title="{l s='Pay by bank wire' mod='bankwire'}" /></div>
<div id="payment_paypal"><input type="button" class="exclusive_large" value="weiter zur Schritt 2" onclick="location.href='{$base_dir_ssl}modules/paypal/payment/submit.php'" title="{l s='Pay by Paypal' mod='paypal'}" /></div>
<div id="payment_nachnahme"><input type="button" class="exclusive_large" value="Auswählen" onClick="location.href='{$base_dir_ssl}modules/cashondelivery/validation.php'" title="{l s='Pay with cash on delivery (COD)' mod='cashondelivery'}" /></div>
</form>
</div>

Here on of  the Radio button:

<div class="payment_module">
<table id="paymentTable" class="std">
<tr>
<td width="20%" valign="middle" align="center">
<input type="radio" name="payment_radio" id="bankwire" /></td>
<td class="payment_option_logo" width="30%" ><img src="{$this_path}bankwire.png" alt="{l s='Pay by bank wire' mod='bankwire'}" width="150" height="40" /></td>
<td width="50%" valign="middle">
<div class="payment_option_title"><h2>Vorkasse / Überweisung</h2></div>
<div class="payment_option_delay">{l s='Pay by bank wire (order process will be longer)' mod='bankwire'}</div></td>
</tr>
</table>
</div>

The script integrated for the test in the header and showing.

Thanks for help 
















best regards