JSFiddle - React, Tailwind, and code Playground
HTML
<div id="lc"> </div>
<iframe id="edit"></iframe>
CSS
#lc { background: #eeeeee; margin-bottom: 5px; width: 200px; border: 1px solid #bbbbbb; }
#edit { width: 200px; border: 1px solid #bbbbbb; }
JavaScript
var f = $('iframe#edit')[0].contentWindow.document;
f.designMode = 'on';
$(f).keyup(function() {
var x = $(this).contents().children('body').children();
$('#lc').text(x.length); // This will be the line number
});