如何计算Div中隐藏的输入元素的数量

时间:2013-09-24 12:42:26

标签: jquery count

here is the code :

   <div class="upload"><br>
  <br>
  <br>
  <input type="hidden" value="" id="SWFUpload_0_3" name="jpg_uploaded_files[]">
  <br>
  <input type="hidden" value="" id="SWFUpload_0_4" name="jpg_uploaded_files[]">
  <br>
  <input type="hidden" value="" id="SWFUpload_0_5" name="jpg_uploaded_files[]">
  <br>
  <input type="hidden" value="" id="SWFUpload_0_6" name="jpg_uploaded_files[]">
  <br>
  <input type="hidden" value="" id="SWFUpload_0_7" name="jpg_uploaded_files[]">
  <br>
  <input type="hidden" value="" id="SWFUpload_0_8" name="jpg_uploaded_files[]">
  <br>
</div>

4 个答案:

答案 0 :(得分:6)

正在工作 DEMO

试试这个

 $('.upload input:hidden').length

答案 1 :(得分:0)

尝试将属性equals filter与属性type

一起使用
var len = $('.upload input[type="hidden"]').length

答案 2 :(得分:0)

$("input[type='hidden']").length;

答案 3 :(得分:0)

试试这个

$('.upload').find($("input[type='hidden']")).length

Demo