자바스크립트 onchange 이벤트

Jmnote (토론 | 기여)님의 2016년 3월 15일 (화) 17:54 판 (223.62.3.107(토론)의 편집을 Jmnote의 마지막 판으로 되돌림)

1 개요

JavaScript onchange Event
자바스크립트 onchange 이벤트
input text 내용 변경 감지

2 소스 코드

<input type="text" value="hello" onchange="bgcolor_yellow(this)" />
<input type="text" value="world" onchange="bgcolor_yellow(this)" />

<script>
function bgcolor_yellow(obj) {
  obj.style.backgroundColor = 'yellow';
}
</script>
→ input text의 내용(hello 또는 world)을 바꾸면 배경색이 노란색으로 바뀐다.

3 같이 보기

4 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}