GlobalEventHandlers.onchange

번역이 완료되지 않았습니다. Please help translate this article from English

onchange 속성은 change 이벤트의 이벤트 핸들러를 설정하고 반환합니다.

구문

target.onchange = functionRef;

functionRefnull 또는 이벤트 핸들러를 지정하는 JavaScript function 함수 중 하나여야 합니다.

예제

HTML

<input type="text" placeholder="Type something here, then click outside of the field." size="50">
<p id="log"></p>

JavaScript

let input = document.querySelector('input');
let log = document.getElementById('log');

input.onchange = handleChange;

function handleChange(e) {
  log.textContent = `The field's value is
      ${e.target.value.length} character(s) long.`;
}

결과

명세

명세 상태 비고
HTML Living Standard
The definition of 'onchange' in that specification.
Living Standard  

브라우저 호환성

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
onchangeChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 9Opera Full support 9Safari Full support 3WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0

Legend

Full support  
Full support

같이 보기