[jQuery] Hide function problem in IE8
Hi all,
I have this jQuery snippet to hide a "DIV" block when the user select
one value of a radio button:
<script type="text/javascript">
$(document).ready(function() {
$("input[name='persona']").change(function() {
if ($("input[name='persona']:checked").val() == '0') {
alert('PersonaFisica');
$('#ragioneSocialeLine').hide();
$('#partitaIvaLine').hide();
$('#sedeLegale').hide();
$('#nomeCognomeLines').show();
$('#generalitaLines').show();
}
else {
alert('PersonaGiuridica');
$('#ragioneSocialeLine').show();
$('#partitaIvaLine').show();
$('#sedeLegale').show();
$('#nomeCognomeLines').hide();
$('#generalitaLines').hide();
}
});
$("input[name='persona']").trigger('change');
and
<span class="sportelloamiacque_formfield">
<input type="radio" id="personaFisica" name="persona"
value="0" /> Persona fisica
<input type="radio" id="personaGiuridica" name="persona"
value="1" /> Persona giuridica
</span>
The problem is that the user "must"click 2 times to obtain that
functionality in IE8, and it works correctly in Firefox and Chrome.
How can I solve this strange problem?
Thanks a lot.
Luigi