获取隐藏输入的值,发送给另一个隐藏输入 [英] Get value of hidden input, send to another hidden input
本文介绍了获取隐藏输入的值,发送给另一个隐藏输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个如下所示的div:
I have a div that looks like this:
<div class="Block Moveable Panel AddToWishlistLink" id="SideProductAddToWishList" style="display:">
<div class="BlockContent">
<form name="frmWishList" id="frmWishList" action="null" method="get">
<input type="hidden" name="action" value="add" />
<input type="hidden" name="product_id" value="117" />
<input type="hidden" name="variation_id" value="" class="WishListVariationId"/>
<input type="submit" class="wishlist-button" value="Add to wishlist" alt="Add to Wish List" />
</form>
</div>
我需要一个JavaScript,该JavaScript可以使用product_id的值(可能是原来的值),然后将其输入到名称和ID为"FormInput528"的隐藏输入中,以便在这种情况下将所述隐藏输入的值更改为,117.我对JS还是很陌生,所以任何帮助都会很棒!谢谢!
I need a JavaScript that can take the value of product_id, what ever it might be and input to a hidden input with the name and ID of "FormInput528" so that the value of said hidden input is changed to, in this case, 117. I am still VERY new to JS so any help would be amazing! Thank you!
推荐答案
如果您使用的是JQuery:
If you're using JQuery:
var product_id_val = $("#product_id").val();
$("#FormInput528").val(product_id_val);
这篇关于获取隐藏输入的值,发送给另一个隐藏输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文