[Example 1] change() 이벤트1
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
<script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#select1").change(function(){
var x=$("#select1 option:selected").text();
$("div").text(x);
});
/* $("#select1").change(function(){
$("div").text("");
var ar = $("#select1 option:selected").text();
$("div").text(ar);
});*/
});
</script>
</head>
<body>
<select id="select1" size=6 >
<!--multiple 셀렉트를 여러개 선택가능하도록 해줌-->
<option value="1">강아지</option>
<option value="2">고양이</option>
<option value="3">호랑이</option>
<option value="4">코끼리</option>
<option value="5">염소</option>
<option value="6">사자</option>
<option value="7">기린</option>
</select>
<br><br>
<div>여기에 표시</div>
</body>
</html>
[출처] [jQuery]change() 이벤트|작성자 천재마도사
'JQUERY > 함수' 카테고리의 다른 글
간편 ajax 통신 - jQuery.getJSON() (0) | 2014.10.15 |
---|---|
jquery 자식 노드 전부 삭제 (0) | 2014.09.11 |
[jQuery] jQuery ajax form 값 전부 넘기기 (serialize 사용) (0) | 2014.09.05 |
[jQuery] hide, show예제 (0) | 2014.09.05 |
jQuery 롤오버 (0) | 2014.08.19 |
Ajax 연동시 history 문제(뒤로가기) (0) | 2014.08.19 |
선택된 <select> (0) | 2014.08.19 |
Ajax Character Set (배열 처리) (0) | 2014.08.19 |