<!-- 테그명으로 접근 -->
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<title>Insert title here</title>
</head>
<body>
이름:<input type="text"><br><br>
이메일:<input type="text"><br><br>
<p>여기가 p tag 1입니다</p>
<p>여기가 p tag 2입니다</p>
<br>
<script type="text/javascript">
$(document).ready(function(){
$("input").focus(function () { //클릭했을 때 focus
$(this).css("background-color","#ffff00"); //노랑
});
$("input").blur(function(){ //벗어났을때
$(this).css("background-color","#fff"); //화이트
});
$("p").mouseover(function () { //마우스 커서가 위에 도달햇을때
$(this).css("background-color","#ff0000"); //레드
});
$("p").mouseout(function () { //마우스 커서가 벗어났을 때
$(this).css("background-color","#fff"); //화이트
});
$("p").dblclick(function(){ //더블 클릭 할 때
alert($(this).text()); //text값을 받아온다 getter역할
});
});
</script>
</body>
</html>
'프로그래밍 > jQuery' 카테고리의 다른 글
jsp로 값 넘겨주기 (0) | 2020.01.13 |
---|---|
버튼 클릭에 따른 결과값(감추기 hide, 보여주기 show, 스위치 toggle) (0) | 2020.01.13 |
db 데이터를 받아와 테이블에 데이터 입력_외부 css 사용 (0) | 2020.01.10 |
hide, show 세부 설정 (0) | 2020.01.10 |
hide함수 활용_this (0) | 2020.01.10 |