asked on June 29, 2022
Using javascript, there is a confirm statement within an IF statement. The problem is that the confirm statement executes on Form Open. Why?
$(document).ready(function(){
//Check the "Provide Names" box and clear all "Attendee Name(s)" if No
$('.provideNames input').change(function () {
if ($(this).val() == "No")
{
// clear all Attendee Name(s)
return 'WARNING: By selecting "No", the names already inputted will be cleared. Choose OK to clear the names or Cancel to leave as is.';
$('.attendeeName input').val("")
}
});
$(".provideNames input:checked").each(function(){
$(this).trigger('change');
});
}); //close document.ready
0
0