it-day
html 요소 추가 꼼수(span)
별지킴Lee
2023. 11. 10. 09:46
<div class="test01">
<div class="test02">
<span class="test03">주소</span>
<span class="msg_err" id="err" style="display: none">오류</span>
</div>
<div class="test04">
<input type="text" id="test_id" value="" placeholder="주소를 입력해 주세요" readonly>
<button type="button" class="btn_blue sub_medium" id="addr_id">주소 검색</button>
</div>
</div>
예를 들어 이렇게 있다면 ( input_err 라는 css class가 있음)
js 파일에서
$("#test_id").focus();
$("#test_id").addClass("input_err");
$("#err").show();
를 해주면
<span class="msg_err" id="err" style="display: none">오류</span> display: none 했던 부분이
조건에 맞게 쓰일시 보였다 안보였다 가능