JSFiddle - React, Tailwind, and code Playground
by badsyntax
HTML
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<input type="text" />
<button>Rebind</button>
JavaScript
function bind() {
console.clear();
$('input')
.off('focus').on('focus', function() {
$(this).val('').select();
console.log('focus');
})
.off('blur').on('blur', function() {
console.log('blur');
})
.off('change').on('change', function() {
console.log('change');
});
}
$('button').click(function() {
bind();
});
bind();