##jquery 기초 공부 사이트
https://www.w3schools.com/jquery/jquery_get_started.asp
jQuery Get Started
jQuery Get Started Adding jQuery to Your Web Pages There are several ways to start using jQuery on your web site. You can: Download the jQuery library from jQuery.com Include jQuery from a CDN, like Google Downloading jQuery There are two versions of jQuer
www.w3schools.com
##jQuery 임포트 (head 태그 사이에!)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
##jQuery 기본 문법
- $ 로 시작하고, 괄호 안에 선택자로 대상을 적으면 됩니다.
1.HTML 숨기기
1
|
$('#contents').hide();
|
cs |
$('#post-box').show();
3.input값 가져오기
- $('id이름').val()
- $('#post-url').val();
4.input값 업데이트
- $('id이름').val(새로 들어갈 내용)
- $('#post-url').val("컨텐츠");
5. HTML 없애기
- $('#cards-box').empty();
6. HTML 추가하기
- // 주의: html 백틱으로 감싼다.
1
2
3
4
5
6
7
8
9
10
|
$('#cards-box').append(`<div class="card">
<img class="card-img-top"
src="https://www.eurail.com/content/dam/images/eurail/Italy%20OCP%20Promo%20Block.adaptive.767.1535627244182.jpg"
alt="Card image cap">
<div class="card-body">
<a href="#" class="card-title">여기 기사 제목이 들어가죠</a>
<p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
<p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
</div>
</div>`);
|
cs |
'SpringBoot > 스파르타 웹개발의 봄 spring' 카테고리의 다른 글
[스파르타 웹개발의 봄 spring] 06 완주 후기/ 수강 할인 링크 (0) | 2021.07.25 |
---|---|
[스파르타 웹개발의 봄 spring] 04.04 자바로 네이버 쇼핑 API 이용하기 (0) | 2021.07.25 |
[스파르타 웹개발의 봄 spring] 05.07 도메인 붙이고 카카오톡에 공유해보기 (0) | 2021.07.22 |
[스파르타 웹개발의 봄 spring] 05.06 포트포워딩 & nohup 적용하기 (0) | 2021.07.22 |
[스파르타 웹개발의 봄 spring] 05.05 EC2 준비하고 배포하기 (0) | 2021.07.22 |