자바스크립트 input 개수 세기

1 개요[ | ]

자바스크립트 input 개수 세기
HTML 요소 개수
input text 개수 확인
input 배열 수 세기
<form name='my_form'>
  <input type='button' onclick='count_input();' value='개수 세기' />
  <hr>
  <input type='text' name='tag' />
  <input type='text' name='tag' />
  <input type='text' name='tag' />
  <input type='text' name='tag' />
  <input type='text' name='tag' />
</form>

<script>
  function count_input() {
    alert(my_form.tag.length);
  }
</script>
→ [개수 세기] 버튼을 누르면 tag[]의 개수 5가 출력된다.

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}