小编Yas*_*ekh的帖子

.each函数跳过隐藏元素并在onchange功能中使用多个选择器

    $('#step1 input').change(function(){
       $('#step1 input').each(function(){
          console.log($(this).val());
       });
    });
    
    $('#step2 input').change(function(){
       console.log($(this).val());
    });
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="step1">
       Father's Details: &nbsp&nbsp&nbsp
       <input name="hiddenelement" type="text" hidden="hidden" value="This is Father's name" />
       <input name="First Name" type="text" placeholder="Enter First Name" />
    </div>
    <div id="step2">
       Mother's Details: &nbsp&nbsp&nbsp
       <input name="First Name" type="text" placeholder="Enter First Name" />
    </div>
Run Code Online (Sandbox Code Playgroud)

我有以下HTML:

<div id="step1">
   Father's Details: &nbsp&nbsp&nbsp
   <input name="hiddenelement" type="text" hidden="hidden" value="This is Father's name" />
   <input name="First Name" type="text" placeholder="Enter First Name" />
</div>
<div id="step2">
   Mother's Details: &nbsp&nbsp&nbsp
   <input …
Run Code Online (Sandbox Code Playgroud)

html jquery

5
推荐指数
1
解决办法
71
查看次数

标签 统计

html ×1

jquery ×1