JSFiddle - React, Tailwind, and code Playground
by shivkumarganesh
HTML
<script src="http://code.jquery.com/jquery-3.3.1.min.js"></script>
<input type="text">
<hr/>
<input type="text">
<hr/>
<input type="text">
<hr/>
<a href="https://google.com">LOLA</a>
JavaScript
var isPageChanged = false;
$(document).ready(function() {
$('body').on('click', 'a', function(e) {
console.log(e.target.href);
e.preventDefault();
});
});
function checkIfChanged(){
return isPageChanged ? true : false;
}
function onTextChange(event) {
if (!isPageChanged) {
isPageChanged = true;
}
console.log(isPageChanged)
}
function checkChange() {
var element = document.querySelectorAll('[type="text"]');
for (var i = 0; i < element.length; i++) {
element[i].addEventListener('change', onTextChange, false);
console.log('lol')
}
}
setTimeout(function() {
checkChange();
}, 3000);