JavaScript build Object for BrightCove - Test only

JavaScript build Object for BrightCove - Test only

by Nirvanachain

HTML

<div class="js-container" data-options='{"height" : "100px", "width" : "150px", "color" : "red"}'>
    <!-- obj1 elements go in here -->
</div>

<div class="js-container" data-options='{"height" : "300px", "width" : "150px", "color" : "blue"}'>
    <!-- obj2 elements go in here -->
</div>

JavaScript

var MyClass = function ($element) {

    this.$element = $element;
    console.log(this.$element);
    
    this.init();
    
};

MyClass.prototype.init = function () {
    console.log('init');
};

$('.js-container').each(function (i, element) {
    new MyClass($(element));
});