Switch button and method not defined

Hi,

specifically stopPropagationAndPreventDefault() (not allowed this in the title?)

Using the latest version of business pack 4.2.0 and when clicking a switch button the js has an exception calling stopPropagationAndPreventDefault() which doesnt exist.

The file in question is:
bp–SwitchButton

specific code block

var d = k(l(), 1)
  , o = class extends d.ButtonBase {
    initialize() {
        super.initialize(),
        this.$element.click(t=>this.onElementClick(t)),
        this.subscribe(this.binding.checked, this.onCheckedChange)
    }
    onElementClick(t) {
        let {checked: e} = this.binding;
        this.isEnabled && (t.stopPropagationAndPreventDefault(),
        ko.isWriteableObservable(e) && e(!e()),
        this.postback(this.binding.click))
    }
    onCheckedChange(t) {
        this.$element.toggleClass(d.BusinessPackCss.stateChecked, t)
    }
}

using asp (not core)

How to fix this, I have reinstalled and reverted to earlier version (4.13) but still the same

Current workaround is to include below in dotmaster

<dot:InlineScript>
    $.Event.prototype.stopPropagationAndPreventDefault || ($.Event.prototype.stopPropagationAndPreventDefault = function () {
        this.stopPropagation(),
            this.preventDefault()
    });

</dot:InlineScript>

Hi! I don’t think you are doing anything wrong, but when I tried to reproduce the issue, but it always works. The snippet which you placed in the InlineScript should be in dotvvm.businesspack.base script, which should be always loaded. Could you please verify that it indeed loads on your page? Maybe loading jQuery multiple times could cause the issue, can you also check that it loads only once?