Jquery triggers the click event that forges the a tag instead of the window.open method

  • 2020-03-30 03:26:46
  • OfStack

var ohtml='<div class="friend-dialog tac pt15 pb20">'+ 
'<div class="f-h32"> You have successfully sent a friend request. </div>'+ 
' <p class="c999"> Upload real avatars, friend applications are easier to pass oh, upload avatars! </p> '+ 
'<a href="<%=path%>/teacher/editUserAvatar.action" target="_blank"><span id="awindowopen" ></span></a>'+ 
' </div>'; 
$.dialog({ 
lock:true, 
title: ' Warm prompt ', 
button: [ 
{value: ' Click upload image ',callback: function () { 
$("#awindowopen").trigger("click"); 
},focus: true 
} 
], 
content:ohtml 
}); 
var ohtml='<div class="friend-dialog tac pt15 pb20">'+
'<div class="f-h32"> You have successfully sent a friend request. </div>'+
' <p class="c999"> Upload real avatars, friend applications are easier to pass oh, upload avatars! </p> '+
'<a href="<%=path%>/teacher/editUserAvatar.action" target="_blank"><span id="awindowopen" ></span></a>'+
' </div>';
$.dialog({
lock:true,
title: ' Warm prompt ',
button: [
{value: ' Click upload image ',callback: function () {
$("#awindowopen").trigger("click");
},focus: true
}
],
content:ohtml
}); 


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> Make sure there is content in the TAB, and simulate the content inside being clicked instead of being clicked <a></a> By clicking 

Related articles: