【发布时间】:2016-10-07 05:06:27
【问题描述】:
我正在尝试获取表单 ID 并将其动态传递到脚本中:
jQuery(document).ready(function() {
var theFormID = jQuery(parent.document).find('.theformclass').find('input[name="form_id"]').val();
});
<script type = "text/javascript" >
jQuery(document).ready(function() {
jQuery('.somebutton').click(function(event) {
jQuery(parent.document).find('#abc_HERE-IS-WHERE-I-NEED-THE-RETURNED-VALUE_number_103').fadeToggle("slow", "linear");
jQuery('#closeShare').removeClass("hide");
jQuery('#closeShare').addClass("show");
});
});
有什么帮助吗? 谢谢!
【问题讨论】:
-
请澄清您的具体问题或添加其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
-
您可以将 id 传递给隐藏字段中的 html,然后从其他脚本中获取隐藏字段的值。
-
您可以将ID存储在一个全局变量(窗口变量)中,然后再次使用