JSFiddle - React, Tailwind, and code Playground

by Alejandro

HTML

<div>Just a regular 'ol DIV</div>
<button>Click me to inspect DIV</button>
<p id="index"></p>
<p id="text"></p>
<p id="width"></p>
<p id="height"></p>

CSS

div {
    width: 250px;
    height: 180px;
    background-color: blue;
    color: #fff;
    padding: 20px;
}
button {
    margin-top: 10px;
}

JavaScript

$('button').click(function() {
    var self = $('div'),
        divIndex = self.index(),
        divText = self.text(),
        divWidth = self.width(),
        divHeight = self.height();

    $('#index').text('Index is: ' + divIndex);
    $('#text').html('Text is: "<em>' + divText + '</em>"');
    $('#width').text('Width is: ' + divWidth + ' pixels');
    $('#height').text('Height is: ' + divHeight + ' pixels');
});