JSFiddle - React, Tailwind, and code Playground
by swaroop206
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="button" class="clbt" value="button">
<div class="foo">fh</div>
<div class="bar">ffg</div>
CSS
.foo{margin-bottom:20px;margin-top:30px;}
JavaScript
$(function() {
$('.clbt').click(function(){
var fd = $('.foo').offset().top - $('.bar').offset().top;
alert(fd);
});
});