Twine Version: 2.3.7
Story Format: Sugarcube 2.31.1
I have a form with checkboxes that some of them are disabled by the main script using a postdisplay function with a filter.
postdisplay["general"] = function () {
if (passage() == "Option") {
if (document.getElementById("checkbox-optionenablecheat").disabled !== null) {
document.getElementById("checkbox-optionenablecheat").disabled = true;
};
};
};
There is also a script in the passage to control the focus.
<<script>>
setTimeout(function(){
var focuslinks = document.getElementById("checkbox-optionenablesound")
if (focuslinks !== null) {
focuslinks.focus();
};
}, 500);
<</script>>
Everything was working fine.
Recently I have decided to reuse that form in a new passage. I put the form and the timeout script in a third passage named StorySettings and put <<include “StorySettings” “div”>> in the original passage Option. The form displays correctly. The form also displays correctly in the new passage.
However, I then find my scripts no longer work. I suspected it was the passage() that failed and it turned out that it was not. When I find out the setTimeout script eased to work as well, I admitted defeat.
Any idea what happened?