
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
</head>
<body>
<p>p tag</p>
<p id="pid">p tag id pid</p>
<p class="cls">p tag class cls</p>
<p name="_name">p tag name_name</p>
<button type="button">click</button>
<script type="text/javascript">
// id 는 확인용 class는 css에 name은 값을 불러올때 자주 사용된다.
$(document).ready(function(){
$("p").click(function(){
console.log( $(this).text()); //p테크를 눌렀을 때 콘솔에 text를 getter로 받아온다.
});
$("button").click(function (){
// $('p').hide();
// $("*").hide();
// $("p#pid").hide();
// $('p.cls').hide();
$('p[name=_name]').hide(); //네임 접근법
});
});
</script>
</body>
</html>
'DEV > jQuery' 카테고리의 다른 글
db 데이터를 받아와 테이블에 데이터 입력_외부 css 사용 (0) | 2020.01.10 |
---|---|
hide, show 세부 설정 (0) | 2020.01.10 |
mouseover, mouseout (0) | 2020.01.10 |
태그 마우스 클릭 시 반응_this, click (0) | 2020.01.10 |
버튼을 누를시 상태변화_textfield/setget (0) | 2020.01.10 |