본문 바로가기
728x90
300x250
SMALL

javaScript545

[javaScript] typeof 데이터 타입 확인하기 console.log(typeof 42); // expected output: "number" console.log(typeof 'blubber'); // expected output: "string" console.log(typeof true); // expected output: "boolean" console.log(typeof undeclaredVariable); // expected output: "undefined" typeof로 반환할 수 있는 값 출처 : https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Operators/typeof 2022. 9. 4.
[자바스크립트]string 문자열에 따옴표 사용하기 문자열을 둘러 싸고 있는 따옴표와 일하지 않는다면 문자열에 따옴표 사용 가능하다. 특수 문자열로 변경하기 만약 다음과 같이 "" 큰따옴표 안에 "" 큰따옴표로 묶인 문자열은 let text = "We are the so-called "Vikings" from the north."; "We are the so-called"까지만 잘리게 된다. 위와같은 상황을 해결하기 위해서 백슬래시 이스케이프 문자를 사용할 수 있다. 백슬래스( \ ) 이스케이프 문자는 특수 문자를 문자열 문자로 변환해준다. 예시 let text = "We are the so-called \"Vikings\" from the north."; let text2 = 'It\'s alright.'; let text3 = "The characte.. 2022. 9. 3.
[jQuery]input에 빈값 확인하고 alert창 띄우기 $('.submit').click(function(){ inputVal = $('input').val(); if(inputVal == ''){ alert('값을 넣어주세요'); $(input).focus() return false; } }) .submit 버튼을 클릭했을 때 만약 input 값이 비어 있다면 alert창을 띄우고 input에 focus를 준다. 2022. 9. 2.
[jQuery] 체크박스(checkBox) 전체선택, 전체해제, 역선택 /* checkbox */ /* 전체선택 */ $(".check-all").click(function(){ $(this).parents('.check-btn').siblings('.check-area').find('input[type=checkbox]').prop('checked',true); }) /* 전체해제 */ $(".check-none").click(function(){ $(this).parents('.check-btn').siblings('.check-area').find('input[type=checkbox]').prop('checked',false); }) /* 역선택 */ $(".check-reverse").click(function () { $(this).parents('.check-b.. 2022. 8. 30.
728x90
반응형
LIST