Home > Article > Backend Development > javascript - event triggered when input value changes
I want to paste the URL into the input, and then make variable 1 equal to the content in the input
I want to paste the URL into the input, and then make variable 1 equal to the content in the input
onchange event can’t be triggered?
<code><input type="text" id="fname" onchange="update()" /></code>
What does it mean? Does it mean that when the URL is pasted in the input, the value of input is assigned to variable 1? jquery? Or something like vue
Give me an idea, first select the dom,const input = document.querySelector('input')
Then bind a keyup event to the dom elementinput.addEventListener('keyup', function(){} )
Then write your logic code
onpropertychange,oninput event