<div id="result"> sf</div>
var input = document.getElementById('test');
var result = document.getElementById('result');
input.onkeyup = input.oncopy = input.onpaste = input.oncut = (function() {
return function() {
result.innerHTML = this.value;
}
})();
<input type="text" class="test">
<div class="result"></div>
const input = document.querySelector(".test");
const result = document.querySelector(".result");
input.onkeyup = input.oncopy = input.onpaste = input.oncut = event => {
if (event.target.value == "value") { // any some condition
result.innerHTML = event.target.value;
// or some code
}
};
var input = document.getElementById('test');
var result = document.getElementById('result');
var firstEnter = true;
input.onkeyup = input.oncopy = input.onpaste = input.oncut = (function() {
return function() {
if (firstEnter) {
firstEnter = false;
//myCondition
}
result.innerHTML = this.value;
}
})();