I am not sure what I'm doing wrong but only the first half of my script is being picked up. I've tried various combinations and can only get one of the if statements to work at a time.
if (!$('#LocalDelivery').is(":checked")) {
$('#datepicker').attr("value", "");
$('#LocalDate').val($('.productAttributeConfigurableEntryText div.productAttributeValue input[type="text"]').val());
$('#LocalDate').attr('name',
$('.productAttributeConfigurableEntryText div.productAttributeValue input[type="text"]').attr('name'));
}
else
{
if (!$('#StandardShip').is(":checked")) {
$('#LocalDate').attr("value", "");
$('#datepicker').val($('.productAttributeConfigurableEntryText div.productAttributeValue input[type="text"]').val());
$('#datepicker').attr('name',
$('.productAttributeConfigurableEntryText div.productAttributeValue input[type="text"]').attr('name'));
}
}
Thank you.
EDIT: To clarify, I do understand 'else' means either one or the other. The problem here is that even if the condition is met for the 2nd if statement, it doesn't execute. I can only get a reaction from one if statment at a time using the above code or any similar variation that I have tried.
To clarify, I do understand 'else' means either one or the other. The problem here is that even if the condition is met for the 2nd if statement, it doesn't execute.You're contradicting yourself. You say you understand that only one can work, but then you say you're surprised by it.elseis a Javascript construct. jQuery is just a JavaScript library you're using.#LocalDeliveryis NOT checked AND #StandardShip is NOT checked. Is that what you want? Could you clarify when you want the code in the second if-statement to execute? Also, are these radio buttons or checkboxes?