I’m using jQuery 1.6.2 and calling a function to disable some html text input controls, based on a date. The code works as expected in Google Chrome, but not in Firefox. I was using .attr, but switched it to .prop. It still works in Chrome, but not Firefox.
Here is my jQuery code.
// Get the dates to compare
var lock_date = new Date($("#lock_date").val()).getDate();
var now = new Date().getDate();
// Check if the lock_date is today
if (lock_date == now) {
$("#indications-row input").prop("disabled", true);
$("#allocations-row input").prop("disabled", false);
} else {
$("#indications-row input").prop("disabled", false);
$("#allocations-row input").prop("disabled", true);
}
I’ve read some other posts, that say if you change .attr to .prop it will work, but it still doesn’t. If anybody knows a work around, please post and answer.
1 Answer