本文介绍了Safari/JQUery-在页面上插入和更新隐藏字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在野生动物园中,我试图向DOM中插入隐藏"字段,然后按如下所示更新其值.
In safari, Im trying to insert a Hidden field into the DOM then update its value as below.
colHiddenFieldId = 'row_100000_0_NewValue'
$("#" + colHiddenFieldId).val('TEST')
但是永远不会设置该值,看起来Safari并不认为隐藏字段存在.我知道是因为它可以在人类已知的所有其他浏览器上使用!!
However the value is never getting set, it looks Safari dosn't think the hidden field exists. I know it does because it works on every other browser known to man!!!
这在狩猎之旅书中是一件坏事吗?
Is this a bad thing to do in safaris book?
推荐答案
您是否肯定您的名字中没有遗漏"0",或者添加了太多?您可以通过循环浏览所有隐藏字段并提醒其ID来查看Safari是否有权访问它:
Are you positive you're not missing a '0' in the name, or maybe adding too many? You can see if Safari has access to it by cycling through all hidden fields and alerting their ID:
$("input[type='hidden']").each(function(){
alert($(this).attr("id"));
});
创建字段...
var myId = "someIdHere";
$("<input />")
.attr("type","hidden")
.attr("id",myId)
.val("Something")
.appendTo("body");
这篇关于Safari/JQUery-在页面上插入和更新隐藏字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!