I have a snippet of javascript that doesn’t seem to be working in safari but it works in all other browsers.
Here is the code
<script type="text/javascript">
$(document).ready(function () {
var contracts = $.evalJSON($("#json_contracts").val());
var contractDropDown = $("#<%= c.cID%>");
var dateDropDown = $("#<%= _startDate.cID %>");
function populateMonths(i) {
dateDropDown.empty();
if (i == 0) {
dateDropDown.append("<option value=\"Select Month\">Select Month</option>");
return;
}
$(contracts[i-1].AvailableBillingMonths).each(function(j) {
var selected = "";
dateDropDown.append("<option value=\"" + contracts[i-1].AvailableBillingMonths[j].InvoiceMonth + "\" " + selected + ">" + contracts[i-1].AvailableBillingMonths[j].InvoiceMonth + "</option>");
});
}
contractDropDown.click(function() {
populateMonths(this.selectedIndex || 0);
});
});
</script>
Can anyone see why it wouldn’t be working? The whole point of this snippet is to populate the date dropdown with the correct months, but it never actually populates it in safari.
Replace the click event with the change event ..
Try this