Home  >  Article  >  Backend Development  >  javascript - event triggered when input value changes

javascript - event triggered when input value changes

WBOY
WBOYOriginal
2016-12-01 00:56:551152browse

I want to paste the URL into the input, and then make variable 1 equal to the content in the input

Reply content:

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn