jQuery input type으로 선택


jQuery 형식에 따라 폼 요소 선택
jQuery 폼 요소 타입으로 찾기
jQuery input 형식으로 선택

예제 코드

    <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script>
$(function() {
  $(":text").each(function() {
    $(this).prop("text");
})
});
</script>

    <input type='text' value='배'/>
<input type='text' value='바나나' />
<input type='text' value='멜론' />

→ text형식의 값 "배", "바나나", "멜론"이 차례로 출력된다.

같이 보기