컴퓨터/Javascript

| 노마드 코더 | 팁 | 자바스크립트 여러 팁 Console-Api, 페이지 텍스트 드래그 막기

no title

console API

1. console.dir()

지정된 JS 객체 속성에 대한 목록을 표시한다.

2. console.time() & timeEnd()

작업 소요 시간을 추적하는데 사용할 수 있는 타이머

console.time()
        : 
        (잡 코드)
        : 
console.timeEnd()

드래그 금지

전체 드래그 금지;

body { 
    -webkit-user-select:none; 
    -moz-user-select:none; 
    -ms-user-select:none; 
    user-select:none 
}

특정 부위만

.draggable {
  -webkit-user-select:all;
  -moz-user-select:all;
  -ms-user-select:all;
  user-select:all
}

텍스트만 드래그를 허용하고 싶을 경우:

.draggable {
  -webkit-user-select:text;
  -moz-user-select:text;
  -ms-user-select:text;
  user-select:text
}

스타일 시트 CSS 접두어 webkit, moz, ms, o 의미
민트코딩 드래그-방지


이외 팁

autofocus

input 태그의 autofocus 속성은
페이지가 로드될떄 자동으로 포커스가 input 요소로 이동됨을 명시한다

innerHTML VS innerText

  1. innerHTML하면 HTML태그가 해석되어 Element 출력
  2. innerText하면 문자열 그대로 HTML코드 출력