JSFiddle - React, Tailwind, and code Playground

by Bryan Barrera

HTML

<button>click</button>
<div class="container">
  <div></div>

  <div></div>
  <div></div>
  <div></div>
  <div></div>
</div>

JavaScript

"use strict";

var object = {
  container: $('.container'),
  item: $('div'),
  textToAlert: 'Working',

  init: function() {


    console.log(this.textToAlert);
  },

  firstFunction: function() {
    // here i should be able to use container and item
    // but when i use my click event it doesn't work. 
    console.log(this.item.length);
  },

  secondFunction: function() {
    // here i should be able to use container and item
  }
}



object.init();

$('button').on('click', object.firstFunction);