jQuery动态改变onclick位置.href
这在 Firefox 中有效,但在 IE 中不起作用:
$("#_results").autocomplete({
source: data,
minLength: 0,
select: function(event, ui) {
$("#log").empty();
log(ui.item.lname + ", " + ui.item.fname + " " + ui.item.sso);
log("Currently in " + ui.item.currentRotation + " rotation");
log("Graduated from: " + ui.item.college);
log("More details can be viewed by clicking here");
$("#log").attr("onclick", "location.href=\'" + ui.item.dataformEntry + "\'\;");
}
具体是 $("#log").attr("onclick", "location.href=\'" + ui.item.dataformEntry + "\'\ ;");
还有其他方法可以做到这一点吗?
This works in firefox but doesn't do anything in IE:
$("#_results").autocomplete({
source: data,
minLength: 0,
select: function(event, ui) {
$("#log").empty();
log(ui.item.lname + ", " + ui.item.fname + " " + ui.item.sso);
log("Currently in " + ui.item.currentRotation + " rotation");
log("Graduated from: " + ui.item.college);
log("More details can be viewed by clicking here");
$("#log").attr("onclick", "location.href=\'" + ui.item.dataformEntry + "\'\;");
}
Specifically $("#log").attr("onclick", "location.href=\'" + ui.item.dataformEntry + "\'\;");
Is there another way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个
try this
你已经尝试过了吗
have you already tried with