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

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations