![](/img/trans.png)
[英]jQuery/JavaScript how to get value of button that click on it, each row of buttons can only active only one button
[英]How to Click one button and active 2 buttons in the same time
您好,我正在編寫多步驟表單,我的jquery腳本使用fieldset標簽將表單分為不同的部分,因此非常好。
我需要某種代碼,如果單擊一個按鈕以同時激活另一個隱藏的按鈕,則該代碼為Hidden,因為正如我提到的jQuery,我將表單分為不同的部分,例如:
如果/ fieldset標簽比fieldset>其他其他表單開始,並且我的表單中有頁眉和頁腳標簽,那么如果我單擊下一個按鈕,並且該按鈕位於頁腳標簽內,則僅更改頁腳容器
因此,如果我將另一個按鈕放在字段集中,然后將其推到下一個按鈕,那么它就可以了,但是我希望將按鈕放置在頁腳中以便美觀。
ieda是將按鈕隱藏在fieldset標記內,並將其與頁腳標記內的按鈕鏈接起來,這是我的代碼,謝謝!
<section1>
<label class="checkbox"><input type="checkbox" name="copy"><i></i><strong>Send a copy to my e-mail address</strong></label>
</section1>
<input type='button' name="Next" class='next action-button' value='Próximo' />
<div class="row">
<header1>
<input type='button' name='Next' class='next action-button' value='Próximo' />
</header1>
</div>
</fieldset>
腳本:在此鏈接中查看js部分: http : //codepen.io/pedroG/pen/hKarC
我試過這個
</section1>
<input type="button" class='hidden_button' style='display:none' value="Próximo" />
<div class="row">
<header1>
<input type="button" name="Next" id='button1' class="next action-button " value="Próximo"/>
</header1>
<script type="text/javascript">
$('#button1').click(function()
{
$('.hidden_button').show();
});</script>
but still with no success`
給他們一個ID並使用jQuery的click函數。
$('#button1').click(function(){ $('#button2').click() });
給這兩者一個類而不是一個id,因為是用於一個元素而不是更多元素,所以我們做:
<input type='button' id='button1' />
<input type='hidden' class='hidden_button' />
<input type='hidden' class='hidden_button' />
$('#button1').click(function()
{
$('.hidden_button').attr('type','button');
});
或此代碼:
<input type='button' id='button1' />
<input type='button' class='hidden_button' style='display:none'/>
<input type='button' class='hidden_button' style='display:none'/>
$('#button1').click(function()
{
$('.hidden_button').show();
});
更好的方法是更改您的jquery,以使您的表單不會被拆分,但是如果這不是一種選擇,則可以使用類似的方法
$(document).ready(function(){
$("#mainButton").click(function(){
$( "#button2" ).click();
$( "#button3" ).click();
});
});
一鍵式同時單擊兩個按鈕:
HTML:
<input type="button" name="Next" id='button2' class="next action-button " value="Próximo" />
<div class="row">
<header1>
<input type="button" name='Next' id='button1' class='next action-button ' value='Próximo' />
</header1>
</div>
jQuery的:
<script type="text/javascript">$('#button1').click(function(){ $('#button2').click() });</script>
感謝所有幫助我的家伙。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.