Hi to everybody.
I was developing an insurance web portal and I have some compatibility problems between JQuery and IE7.
Using mozilla and chrome all goes well, but using IE7 it seems that it doesn’t read jquery code at all. this is js code I use:
<script type="text/javascript">
<!--
$(document).ready(function(){
$(".form").validate();
$(".plan").hide();
$(".fasce").hide();
$('.datepicker').datepicker({
dateFormat: 'dd/mm/yy',
// showOn: "button",
// buttonImage: "css/images/calendar.gif",
// buttonImageOnly: true
});
$("#policy_type").change(function(){
if($("#policy_type").val() == 1){
$(".plan").fadeIn();
$(".fasce").fadeIn();
}
else{
$(".plan").fadeOut();
$(".fasce").fadeOut();
}
});
$('#polizza3 fieldset').hide();
$('#0').show();
$('#menu a').click(function(){
$('#polizza3 fieldset').hide();
$($(this).attr('href')).show();
});
});
function selDestination(policy_type){
$.get("select_destination.php", { policy: policy_type, requestItems: 'destinazioni'},
function(dataDestinazioni){
$("select[id='destination']").empty();
var options = '<option value="">Seleziona la destinazione</option>';
var arrayDestinazioni = dataDestinazioni.split( '||');
for (var i = 1; i < arrayDestinazioni.length; i++) {
var destination = arrayDestinazioni[i].split( /,/);
options += '<option value="' + destination[0] + '">' + destination[1] + '</option>';
}
$("select[id='destination']").html(options);
});
}
//-->
And this is the html/php code:
<tr><td><form id="polizza1" name="polizza1" method="post" action="?page=acquista-polizza&p=2" class="form">
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="14" height="20" class="Stile1"> </td>
<td width="276" class="Stile1"><label for="product">Tipo di Prodotto*</label></td>
</tr>
<tr>
<td height="20"> </td>
<td><select name="product" class="Stile3 required" id="product">
<option value="multirisks">Multi Risks</option><td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="14" height="20" class="Stile1"> </td>
<td width="276" class="Stile1"><label for="policy_type">Tipo di Polizza*</label></td>
</tr>
<tr>
<td height="20"> </td>
<td><select name="policy_type" class="Stile3 required" id="policy_type" onchange="selDestination(this.value);">
<option value="">Seleziona il tipo di polizza</option>
<?php
$query = "SELECT * FROM tipi_polizza";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
$id = $row["id"];
$policy_type = $row["tipo_polizza"];
?>
<option value="<?php echo $id; ?>"><?php echo $policy_type; ?></option>
<?php
}
?>
</select></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr class="plan">
<td width="14" height="20" class="Stile1"> </td>
<td width="276" class="Stile1"><label for="plan">Coperture*</label></td>
</tr>
<tr class="plan">
<td height="20"> </td>
<td><select name="plan" class="Stile3">
<option value="">Scegli il livello di copertura</option>
<option value="argento">Argento</option>
<option value="oro">Oro</option>
<option value="platino">Platinum</option>
</select></td>
</tr>
<tr class="plan">
<td> </td>
<td> </td>
</tr>
<tr>
<td height="19"> </td>
<td class="Stile1"><label for="insured_type">Assicurati *</label></td>
</tr>
<tr>
<td> </td>
<td><select name="insured_type" class="Stile3 required" id="insured_type">
<option value="">Seleziona gli assicurati</option>
<?php
$query = "SELECT * FROM tipi_assicurati";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
$id = $row["id"];
$insured_type = $row["tipo_assicurato"];
?>
<option value="<?php echo $id; ?>"><?php echo $insured_type; ?></option>
<?php
}
?>
</select></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="18"> </td>
<td class="Stile1"><label for="destination">Destinazione *</label></td>
</tr>
<tr>
<td> </td>
<td><select name="destination" class="Stile3 required" id="destination">
<option value="">Seleziona la Destinazione</option>
</select> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="19"> </td>
<td><table width="239" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="115" class="Stile1"><label for="inception">Decorrenza *</label></td>
<td width="13"> </td>
<td width="115" class="Stile1"><label for="expiration">Scadenza *</label></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td><table width="239" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="115"><input name="inception" type="text" id="inception" size="10" class="required date datepicker" value="<?php echo $today ?>" /></td>
<td width="13"> </td>
<td width="115"><input name="expiration" type="text" id="expiration" size="10" class="required date datepicker" value="<?php echo $today; ?>" /></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="19"> </td>
<td><table width="239" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="115" class="Stile1"><label for="individual">Numero di Assicurati *</label></td>
<td width="13"> </td>
<!--<td width="115" class="Stile1"><label for="trip_cost">Costo del viaggio <?php if($_POST["policy_type"] == 1){ echo "*"; } ?></label></td>-->
</tr>
</table></td>
</tr>
<tr>
<td height="19"> </td>
<td><table width="239" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50"><label for="fascia1"><span class="Stile1">0 - 1 anni</span></label>
<td width="13"> </td>
<td width="50"><label for="fascia2"><span class="Stile1">2 - 17 anni</span></label>
<td width="13"> </td>
<td width="50"><label for="fascia3"><span class="Stile1">18 - 64 anni</span></label>
</tr>
<tr>
<td width="50"><input name="fascia1" type="text" id="fascia1" size="3" value="0" class="required" /></td>
<td width="13"> </td>
<td width="50"><input name="fascia2" type="text" id="fascia2" size="3" value="0" class="required" /></td>
<td width="13"> </td>
<td width="50"><input name="fascia3" type="text" id="fascia3" size="3" value="1" class="required" /></td>
<!--<td width="115"><input name="trip_cost" type="text" id="trip_cost" size="5" <?php if($_POST["policy_type"] == 1){ echo "class=\\"required\\""; } ?> /> <span class="Stile3">€</span></td>-->
</tr>
<tr class="fasce">
<td width="50"><label for="fascia4"><span class="Stile1">65 - 74 anni</span></label>
<td width="13"> </td>
<td width="50"><label for="fascia5"><span class="Stile1">75 - 84 anni</span></label>
<td width="13"> </td>
<td width="50"><label for="fascia6"><span class="Stile1">+85 anni</span></label>
</tr>
<tr class="fasce">
<td width="50"><input name="fascia4" type="text" id="fascia4" size="3" value="0" class="required" /></td>
<td width="13"> </td>
<td width="50"><input name="fascia5" type="text" id="fascia5" size="3" value="0" class="required" /></td>
<td width="13"> </td>
<td width="50"><input name="fascia6" type="text" id="fascia6" size="3" value="0" class="required" /></td>
<!--<td width="115"><input name="trip_cost" type="text" id="trip_cost" size="5" <?php if($_POST["policy_type"] == 1){ echo "class=\\"required\\""; } ?> /> <span class="Stile3">€</span></td>-->
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="preventivo" id="preventivo" value="Calcola Preventivo" /></td>
</tr>
</table>
</form></td></tr>
Please help me!!! It’s very important…thanks to everybody!