2024-10-16

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script>
/*
이벤트 이름(목록)
blur, change, load, upload, resize, scroll,
select, wubmit, click, dblclick, mousedown,
mouseup, mousempve, mouseover, mouseout,
mouseleave, focus, keydown, keypress, keyup,...
*/
$(function() {
$(".menu li").on("click", function() {
alert($(this).html());
// this : 내가 선택한(클릭한) 요소
});
});
</script>
</head>
<body>
<ul class="menu">
<li>짜장면</li>
<li>짬뽕</li>
<li>탕수육</li>
<li>볶음밥</li>
<li>군만두</li>
</ul>
</body>
</html>

'JQuery > 기초 내용 정리' 카테고리의 다른 글
| JQuery(Event)_04 (0) | 2024.10.16 |
|---|---|
| JQuery(Event)_03 (0) | 2024.10.16 |
| JQuery(Event)_01 (0) | 2024.10.16 |
| JQuery_23 (0) | 2024.10.16 |
| JQuery_22 (0) | 2024.10.16 |