[면접예상] 20230720

neul·2023년 7월 20일

면접예상

목록 보기
31/36
post-thumbnail

🌵jquery에 대하여 설명(장점)하시오.

  • 라이브러리
  • 웹 개발에서 사용되는 DOM 조작, 이벤트 처리, 애니메이션, AJAX 등을 간편하게 처리할 수 있도록 도와주는 도구

🌵jquery 의 아래의 함수를 설명하시오.

html()
선택한 요소의 내용을 HTML 형식으로 가져오거나 설정
text()
선택한 요소의 내용을 텍스트 형식으로 가져오거나 설정
val()
입력 요소(input, select, textarea 등)의 값을 가져오거나 설정

🌵jquery를 통하여, 태그 객체를 생성하는 방법은?

var new = $("<태그명>", {속성명});

🌵remove() 와 empty() 의 차이는?

remove()
선택한 요소와 해당 요소의 모든 자식 요소를 제거 (요소가 완전히 삭제)

empty()
선택한 요소의 모든 자식 요소를 제거 (요소 자체는 남아있고 내용만 비움)

🌵jquery를 이용하여 디지털 시계를 만드시오.

<!DOCTYPE html>
<html>
<head>
    <title>Document</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>

    <style>
        #clock {
            font-size: 24px;
            font-weight: bold;
        }
    </style>

</head>
<body>
    <div id="clock"></div>
    <script>
        function updateClock() {
            var now = new Date();
            var hours = now.getHours().toString().padStart(2, '0');
            var minutes = now.getMinutes().toString().padStart(2, '0');
            var seconds = now.getSeconds().toString().padStart(2, '0');
            var timeString = hours + ":" + minutes + ":" + seconds;
            $("#clock").text(timeString);
        }

        $(document).ready(function() {
            updateClock();
            setInterval(updateClock, 1000);
        });
    </script>
</body>
</html>
profile
🍙

1개의 댓글

comment-user-thumbnail
2023년 7월 20일

항상 좋은 글 감사합니다.

답글 달기