Home > Web Front-end > JS Tutorial > jquery trigger fakes the click event of a tag to replace the window.open method_jquery

jquery trigger fakes the click event of a tag to replace the window.open method_jquery

WBOY
Release: 2016-05-16 16:43:17
Original
1317 people have browsed it
var ohtml='<div class="friend-dialog tac pt15 pb20">'+ 
'<div class="f-h32">您已经成功发送好友申请。</div>'+ 
' <p class="c999">上传真实头像,好友申请更容易被通过哦,赶紧上传头像吧!</p> '+ 
'<a href="<%=path%>/teacher/editUserAvatar.action" target="_blank"><span id="awindowopen" ></span></a>'+ 
' </div>'; 
$.dialog({ 
lock:true, 
title: '温馨提示', 
button: [ 
{value: '点击上传图像',callback: function () { 
$("#awindowopen").trigger("click"); 
},focus: true 
} 
], 
content:ohtml 
}); 
var ohtml='<div class="friend-dialog tac pt15 pb20">'+
'<div class="f-h32">您已经成功发送好友申请。</div>'+
' <p class="c999">上传真实头像,好友申请更容易被通过哦,赶紧上传头像吧!</p> '+
'<a href="<%=path%>/teacher/editUserAvatar.action" target="_blank"><span id="awindowopen" ></span></a>'+
' </div>';
$.dialog({
lock:true,
title: '温馨提示',
button: [
{value: '点击上传图像',callback: function () {
$("#awindowopen").trigger("click");
},focus: true
}
],
content:ohtml
}); 
Copy after login


Things to note:

In this place:

<a href="<%=path%>/teacher/editUserAvatar.action" target="_blank"><span id="awindowopen" ></span></a> 
<a href="<%=path%>/teacher/editUserAvatar.action" target="_blank"><span id="awindowopen" ></span></a>
<a>标签内一定要有内容,并且要模拟里面的内容被点击而不是<a></a>被点击
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template