#jQuery
-
[jQuery] 더보기/닫기 버튼 만들기개발 여정/JavaScript 2021. 9. 13. 18:47
문제 출처: http://marondal.com/lesson/quiz_contentlessonId=10019&lectureId=10006&lectureListId=10079&quizListId=10189 $('.explanation').hide(); $('#moreBtn').on('click',function(){ if($('.explanation').is(':visible')){ $('.explanation').hide(); $('#moreBtn').text('더보기'); } else { $('.explanation').show(); $('#moreBtn').text('닫기'); } });
-
[jQuery] 금칙어 포함 여부 확인하기개발 여정/JavaScript 2021. 9. 13. 18:40
문제출처: http://marondal.com/lesson/quiz_content?lessonId=10019&lectureId=10006&lectureListId=10079&quizListId=10189 $('#wordConfirmBtn').on('click',function(){ var bannedWords = ["십장생", "시베리아", "조카신발", "쌍쌍바", "십원짜리"]; var inputWord = $('#word').val(); for(var words of bannedWords){ if(inputWord.includes(words)){ alert("금칙어가 포함되어 있습니다. 검색할 수 없습니다."); } } });
-
[jQuery] 버튼 클릭을 통한 동적 이벤트들개발 여정/JavaScript 2021. 9. 13. 00:27
예제 출처: http://marondal.com/lesson/example_code?lessonId=10019&lectureId=10006&lectureListId=10079&exampleListId=10158 1. 버튼 클릭하면 다른 input에 텍스트 복사하기 $('#confirmBtn').on('click', function(){ var text = $('#text').val(); text = text.trim(); if(text.length < 1 ){ alert("텍스트 영역에 글자를 써주세요."); return; } $('#copytext').val(text); }); 2. 상자에 글씨 넣기 $('#textInDivBtn').on('click',function(){ $('.box').text(..