JavaScript How to call javascript class function from closure call javascript class from html,call javascript class function,call

I'm working on a jQuery plugin that does not have a selector. When initializing it, I instanciate an object that has functions. In these functions, I need to use closures. In these closures, I would like to call my initial object functions.

To make it more clear, here is a simplified version of the code.

HTML

<script src="/path/to/jquery/2.1.1/jquery.min.js"></script>
<script src="/path/to/my/script/myeditor.js"></script>

<div class="editable">Div1</div>
<div class="editable">Div2</div>

<script>
    $.myeditor({
        option1: 'a',
        option2: 'b'
    });
</script>

myeditor.js

function ($) {

var MyEditor = function (options)
{
    this.$options = $.extend(true, {}, $.myeditor.defaults, options);
    this.init();
};

$.myeditor = function (options = {})
{
    return new MyEditor(options);
};

$.flyeditor.defaults = {
    option1: '1',
    option2: '2'
};

MyEditor.prototype.notify = function(message = '')
{
    console.log(message);
};

MyEditor.prototype.init = function()
{
    // Do stuff
    $('.editables').each(function() {
        $this = $(this);

        // Here comes the error
        notify($this.html());
    });
};

}(jQuery);

The problem is that notify(this.html()); raises an error ReferenceError: notify is not defined

How can I reach this notify method?

Answer:1

I need to store client side data temporarily. The data will be trashed on refresh or redirect. What is the best way to store the data? using javascript by putting the data inside a variable var data ...

I need to store client side data temporarily. The data will be trashed on refresh or redirect. What is the best way to store the data? using javascript by putting the data inside a variable var data ...

Is there any time when var result = !value ? null : value[0]; would not be equivalent to var result = value ? value[0] : null;

Is there any time when var result = !value ? null : value[0]; would not be equivalent to var result = value ? value[0] : null;

So I have a data.table object that is being outputed like this: gender hair-color pets group1.totals group2.totals group3.totals F black Y 10 0 ...

So I have a data.table object that is being outputed like this: gender hair-color pets group1.totals group2.totals group3.totals F black Y 10 0 ...

I am working on code written by someone else. To my knowledge its not correct but I am not seeing any errors and so now I am not sure if something changed since version 8. The code is as below & ...

I am working on code written by someone else. To my knowledge its not correct but I am not seeing any errors and so now I am not sure if something changed since version 8. The code is as below & ...