본문 바로가기
TIL/Today I Learned

[Develop] 23.06.07 개발 공부 일지

by 임성장 2023. 6. 8.
728x90

요약: 제이쿼리 문법, 정규식, kinfa 수정

일시: 23.06.07

장소: 더휴먼컴퓨터아트아카데미

배운 점:

Javascript

  • 정규식
let regid = /^[a-zA-z0-9]{4,}$/
let regpw = /^.*(?=^.{8,16}$)(?=.*\\d)(?=.*[!@#$%^&*()_+])/
// let regpw = /^.*(?=^.{8,16})$/
let regname = /^[a-zA-Z가-힣]{2,20}$/
let regphone = /(^010)([0-9]{3,4})([0-9]{4})$/
// let regemail = /^\\w\\@([a-zA-z])\\.[a-zA-z]{2,3}?\\.?([a-zA-z])$/
let regemail=/^[a-zA-Z0-9]([-_.]?\\w+)*@[a-zA-Z0-9]([-_.]?[a-zA-Z0-9])*\\.[a-zA-Z]{2,3}$/g;

Jquery

//toggle
$('.click').click(function(){
    $('#imgs img').toggleClass('transi')
})

let a = $('#input1').val("김가은 바보");
let b = $('#textarea1').val("김가은 헬스 성공");
let c = $('#select1').val('city1');
let d = $('#select2').val(['town2','town3']);
console.log("🚀 ~ file: script.js:39 ~ d:", d)
//empty
$('.empty').empty();
// 1.수치조작
const wid1 = $('#p1').width();
const wid2 = $('#p2').innerWidth();
const wid3 = $('#p2').outerWidth();

$('#p2').outerWidth('300px').height('400px');
// 2. 위치 조작
let txt1 = $('.txt-1 span')
let txt2 = $('.txt-2 span')
let box1 = $('#wrap1>.box1')

let off_t = box1.offset().top;
let pos_t = box1.position().top;
txt1.text(off_t)
txt2.text(pos_t)
// 3. 스크롤 위치
let topNum = $('.bar').offset().top;
console.log("🚀 ~ file: script.js:63 ~ topNum:", topNum)

$(window).scrollTop(topNum);

let sct = $(window).scrollTop();
console.log("🚀 ~ file: script.js:68 ~ sct:", sct)

 

부족한 점:

호버되는 ul의 길이만큼 bg의 길이 맞추기

728x90