Jquery 表单的动态设置操作属性在Firefox中不起作用
我通过以下行设置表单标记的action属性Jquery 表单的动态设置操作属性在Firefox中不起作用,jquery,html,firefox,Jquery,Html,Firefox,我通过以下行设置表单标记的action属性 $("#divIsInternational span").bind('click', function() { $('#action').val('bypcgDestination'); var SelectedItem = $(this).attr("id"); if (SelectedItem.toString() == "Domestic") { $(this).removeClass().addC
$("#divIsInternational span").bind('click', function() {
$('#action').val('bypcgDestination');
var SelectedItem = $(this).attr("id");
if (SelectedItem.toString() == "Domestic") {
$(this).removeClass().addClass("domestic selected");
$(this).siblings().removeClass("selected");
$("#toDefaultPage").attr("action", "home/domestic");
}
else {
$(this).removeClass().addClass("international selected");
$(this).siblings().removeClass("selected");
$("#toDefaultPage").attr("action", "home/international");
}
$("#isDomesticInMaster").val(SelectedItem);
$("#toDefaultPage").submit();
});
它在chrome中工作正常,但在firefox中没有,我无法找到问题,因为firefox控制台也没有显示一些错误消息如果选择器#toDefaultPage是一个表单元素,那么您应该能够使用jQuery内置的
.submit()
-函数:我想分享我在这里遇到的问题,实际上,我得到了一个隐藏字段的id作为action。通过它,我无法设置表单标签的action字段。所以问题是id=“action”的隐藏字段