You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CustomScripts section is no longer viable to reference scripts that depend on jQuery. The newer versions of the CDTS .Net packages changed to loading jQuery dynamically. As a result, scripts referenced in the CustomScripts section may load and execute before jQuery has loaded. The better option is to add your script references to HTMLBodyElements in your code.
This will ensure that jQuery is loaded before your scripts are loaded.
Regarding the wb-ready.wb event, there is no guarantee that the document.ready event will fire before the wb-ready.wb event. Additionally, in the HTML Basic mode, the wb-ready.wb event doesn't fire at all.
I've implemented the following for scripts that rely on jQuery and the wb-ready.wb event:
// this updated implementation of $(document).ready() guarantees the code will run even if the script loads after the event has already fired.
$(function () {
if (wb.isDisabled) {
initializeBasicHTMLSubmitHandler();
}
else {
if (wb.isReady) {
initializeSubmitHandler();
}
else {
$(document).on("wb-ready.wb", function () {
initializeSubmitHandler();
});
}
}
});
Hi
I used the latest CDTS .Net package (5.0.4) in my .Net Framework 4.8 MVC project.
I put this in a simple hello word view :
I see document ready in the console, but not wet ready.
Note, I had to add a ref to jQuery, even if the wet already has one.
Any idea?
Regards
The text was updated successfully, but these errors were encountered: