본문 바로가기

개발/javascript40

javascript onclick this 값 넘겨서 형제 class 변경, 대상 class 변경 HTML javascript function changeFocus(obj){ $('.swiper-slide').siblings().attr({'class': 'swiper-slide'}); $('#'+obj).attr({'class': 'swiper-slide swiper-slide-active'}); } 형제 데이터 class 전부 swiper-slide 로 변경 대상은 ... active로 변경 2021. 7. 2.
input enter 시 스크립트 실행 인풋창에서 엔터 입력시 (event.keyCode==13) search() 실행 2021. 6. 15.
div 텍스트 가운데 정렬 텍스트 2021. 6. 8.
script 배열 선택자 값 존재 체크 function checkArrayValueNull(arr){ var inp = document.getElementsByName('main_material_approximate_date[]'); for(i=0;i 2021. 6. 1.
script append mobile $(document).ready(function(){ $(window).scroll(function(){ if($(window).scrollTop() >= $(document).height() - $(window).height()-60){ $('#cicle_show').css('display',''); appendData(); } }); }); 2021. 5. 12.
script 문자열 포함 처리 if(json_data.for_what.match('1'))$('[name=for_what1]').prop('checked', true); 2021. 5. 7.
html 영역 pdf 다운 여러 페이지 처리 한글처리 jspdf.min.js html2canvas.js window.onload= function(){ setTimeout(function() { html2canvas($("#printarea"), { background :"#FFFFFF", onrendered : function(canvas) { // 한글깨짐현상때문에 jpeg->jspdf 전환 var imgData = canvas.toDataURL("image/jpeg"); var pageWidth = 210; //가로 길이 a4 기준 var pageHeight = pageWidth * 1.414; //출력 페이지 세로길이 var imgWidth = pageWidth - 20; var imgHeight = canvas.height * imgWidth / canvas.width; var heightLeft.. 2021. 4. 12.
checkbox script로 체크 리스트 값 출력하기 html javascript var chk_arr = []; $("[name=codes]:checked").each(function(){ var chk = $(this).val(); chk_arr.push(chk); console.log(chk_arr); 2021. 4. 12.
javascript input 배열 유효성검사 예제 item[] model[] sn[] pd[] 4개의 값을 갯수만큼 유효성검사 var index_data=$(\"input[name='item[]']\").length-1; for (let i = 0; i 2021. 4. 2.
script 마지막 형제 찾기 예제 children() last() console.log($('#item_list').children().last()); function delForm() { // console.log(); var length = $('#item_list').children().length; if(length>1){ console.log($('#item_list').children().last()); } } 2021. 4. 2.
구글 마커 안나옴 Error InvalidValueError: setMap: not an instance of Map; and not an instance of StreetViewPanorama error code Error InvalidValueError: setMap: not an instance of Map; and not an instance of StreetViewPanorama before code function makeGMap(lat,lng,code){ var mapdata="map"+code var latdata=lat var lngdata=lng var myLatLng = { lat:latdata, lng:lngdata }; var mapcode = new google.maps.Map(document.getElementById("map"+code), { zoom: 16, center: myLatLng }); var markercode = new google.maps.Marker.. 2021. 3. 31.
페이지 접속시 자동으로 탭 클릭하고 지정 영역으로 스크롤 이동 $( document ).ready(function() { $('#prdReview2').trigger("click"); setTimeout(function() { var location = document.querySelector("#shopTab").offsetTop; window.scrollTo({top:location, behavior:'smooth'}); }, 700); }); () () 2021. 3. 11.