2021-06-30

How to reuse function attribute?

I want to do something like the following:

function StatusBox() {
    this.connectionStatus = $("#connectionStatus");
}

StatusBox.nosupport = function(type) {
    StatusBox.connectionStatus.html('<span style="color: red;">' + NO_SUPPORT + '</span>');
};

StatusBox.error = function(type) {
    StatusBox.connectionStatus.html('<span style="color: red;">' + ERROR + '</span>');
};

But I get Uncaught TypeError: Cannot read property 'html' of undefined

How do I reuse $("#connectionStatus") in the child functions?



from Recent Questions - Stack Overflow https://ift.tt/2UepwHr
https://ift.tt/eA8V8J

1 comment:

  1. It is critical that we read blog content thoroughly. I've already completed it and think this post is fantastic. Let's examine various diverse themes, such as the jitter click cps . The Minecraft 'PvP' alliance coined the method of jitter clicking. It's all about shaking your hand as rapidly as you can on the mouse.

    ReplyDelete