Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- nextjs 메일보내기
- 카카오맵 api
- swiper
- 함수
- Til
- 프로그래머스
- react
- 다중포인터
- JavaScript
- App Router
- use Client
- 프론트 본인인증
- 사이트맵
- 전체 너비로 css
- nextjs
- 알고리즘
- Next.js 나이스 본인인증
- 구글 메일보내기
- React 나이스 신원인증
- nextjs contact us
- 빈도수세기
- 메일 보내기 react
- CSS
- react swiper
- pass인증
- next15
- robots.txt
- github
- 카카오지도 구현
- web3-react
Archives
- Today
- Total
YEV.log
jQuery | 주요 기능 정리 (css, 태그, 이벤트, 모달) 본문
CSS 컨트롤
css 속성 지정하여 추가하기
$('#searchBtn').css('display', 'none');
class 추가 하기 , 삭제 하기
$('#searchBtn').addClass('disabled-btn');
$('#searchBtn').removeClass('disabled-btn');
class 가 있는지 없는지 확인
$('#searchBtn').hasClass('on') // true & false 로 반환
태그 속성 컨트롤
a 태그 href 변경하기
<a href="javascript:void(0);" id="mypage">마이페이지</a>
$('#mypage').attr(
'href',
`/mypage?offset=0&limit=20`
);
a 태그의 href 제거하기 (클릭 disabled)
$('#mypage').removeAttr('href');
button disabled 기능 true, false 설정
$('#searchBtn').attr('disabled', true);
$('#searchBtn').attr('disabled', false);
태그 자체 삭제
$('#code').remove();
태그안의 내용 삭제
$('#code').empty(); //<h1><h1> 이런식으로 처리됨.
태그로 감싸진 텍스트, input value 출력 및 수정하기
<span id="title">닉네임검색</span>
<input type="text" id="nick_sch" />
$('#title').text(); //닉네임검색
$('#nick_sch').val(); //input에 입력한 value값 출력
$('#title').text('닉네임조회');
$('#nick_sch').val('nick');
이벤트 컨트롤
onclick 이벤트
<button type="submit" id="searchAction"> 조회 </button>
$('#searchAction').click(function () {
console.log("닉네임 조회 버튼 Click");
});
onchange 이벤트 (keyup)
<input type="text" id="nick_sch" />
$(document).ready(function () {
$('#nick_sch').keyup(function () {
const qty = $(this).val();
});
});
bootstrap modal 컨트롤
modal on , off 컨트롤
$('#modalWallet').modal('toggle');
$('#modalWallet').modal('show');
$('#modalWallet').modal('hide');
modal이 꺼지는 것을 감지 (모달 외부를 클릭해서 꺼졌을 때)
$(document).on('hide.bs.modal', '#codeModal', function () {
$('#code').empty();
});
추가 기능
여러개의 id가 중복 기능을 해야할 때
$('#id-1, #id-2, #id-3').attr('disabled', true).addClass('disabled-btn');
공통으로 쓰이는 변수, 객체 정의 및 사용하기
// 정의
$.LIMIT = 20;
$.ROUTER_URL = {
login: '/auth/login',
logout: '/auth/logout',
mypage: '/mypage'
}
// 사용
const url = `${$.ROUTER_URL.mypage}?offset=0&limit=${$.LIMIT}`
반응형
'Web > JavaScript' 카테고리의 다른 글
javascript | Cookie 설정하기, value 가져오기, 삭제하기 (0) | 2022.07.19 |
---|---|
Javascript | 문자열, 글자 마스킹하는 함수 (0) | 2022.02.20 |
Javascript | 로그인 기능 구현 (2) | 2021.10.24 |
JavaSctipt | DOM 이란? (1) | 2021.10.24 |
JavaScript | 객체 속성에 접근하는 방법 (점 표기법 / 대괄호 표기법) (0) | 2021.09.06 |