본문 바로가기
[jQuery]$(".checkbox").attr("checked", true); VS $( '.checkbox' ).prop( 'checked',true); .attr() HTML 마크업에 정의되고 요소의 속성값을 가져오거나 속성을 추가한다. 속성값은 String형으로 가져온다. //속성의 값 가져오기 //.attr(attributeName); $('#button').attr('checked'); // checked //속성의 값 추가하기 //.attr( attributeName, value ) $('#checkbox').attr('checked', true); .prop() HTML DOM 트리에 정의되고 요소의 속성값을 가져오거나 속성을 추가한다. 속성 값은 javascript 형식으로 넘어오기 때문에 boolean, date, function 등도 가져올 수 있다. //속성의 값 가져오기 //.prop(propertyName) $('#checkbox').. 2022. 1. 9.
[Javascript] 이벤트 등록하는 방법 3가지 1. 인라인 방식(inline) 이벤트를 html 요소의 속성으로 직접 지정하는 방식 html 코드와 스크립트가 섞여 사용, html 코드와 스크립트 코드는 분리가 유지보수에 용이하다고 하지만.. 우리 회사 같은 경우에는 굉~~ 장히 많이 사용되고 있는 방식 중 하나라 알아두면 요긴하게 쓰인다. Test 2. 프로퍼티 방식(Property) 이벤트를 자바스크립트 코드에서 프로퍼티로 등록하여 사용하는 방식 html 코드와 자바스크립트가 섞여 사용되지 않음 하나의 이벤트 핸들러 프로퍼티엔 하나의 이벤트핸들러만 바인딩 가능 let testBtn = document.querySelector('#testBtn'); testBtn.onclick = function () { alert('Hello world1'); .. 2022. 1. 9.
[jQuery][Javascript] Getting attribute of a parent node $(this).parentNode.attr('class') Getting attribute of a parent node $(this).parentNode.attr('class') jquery와 plain javascript를 섞어 섰다는것.. java 사용해서 백엔드단만 작업하다보니 전혀 생각못했던 부분이었다.. jquery를 사용하는곳이 아직 많기 때문에 해당부분을 유의해서 코드작업을 해야할것 같다. // jQuery $(this).parent().attr('class'); // Vanila Javascript this.parentNode.getAttribute("class"); attr() 메서드와 getAttribute()메서드 .attr() 메서드 .attr(attributeName) .attr(attributeName,value) 선택한요소의 속성의 .. 2022. 1. 1.
[GitHub] remote: Support for password authentication was removed on August 13, 2021. Plea.. remote: Support for password authentication was removed on August 13, 2021. Plea.. 오랜만에 git bash를 이용해 원격저장소에 commit 하려고 했다. 평소랑 똑같이 계정 정보 입력해서 원격저장소에 push 했다. 근데 에러.. 토큰이 필요하다고 한다. 2021년 8월이후 적용된 방법이라 모를수도 있을듯 토큰 갱신 방법은 아래 블로그에 잘 정리되어있다. Reference GitHub 토큰 인증 로그인 하기 - [오류 해결]: remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. 2021. 12. 24.