User:Chaotic Enby/Unblock wizard.js: Difference between revisions

From Test Wiki
Content deleted Content added
why did i do this already
check for emptiness
Line 262: Line 262:


afc.beforeUnload = function (e) {
afc.beforeUnload = function (e) {
var changedContent = false;
e.preventDefault();
for (var [i, label] of questionLabels.entries()) {
if (ui.itemsInput[i].getValue() != "" && questionFields[label] != 2) {
changedContent = true;
}
if (ui.itemsInput[i].getValue() != "Yes." && questionFields[label] == 2) {
changedContent = true;
}
}
if(changedContent){
e.preventDefault();
}
e.returnValue = '';
e.returnValue = '';
return '';
return '';