我想打开"下拉菜单选项。
(无法更改下面的html源文件)
<ul id="nav-People-container">
<li id="nav-Owner">
<a href="/otrs/index.pl?Action=AgentTicketOwner;TicketID=REDACTED" class="AsPopup PopupType_TicketAction" title="Change the owner for this ticket">Owner</a>
</li>
<li id="nav-Responsible">
<a href="/otrs/index.pl?Action=AgentTicketResponsible;TicketID=REDACTED" class="AsPopup PopupType_TicketAction" title="Change the responsible for this ticket">Responsible</a>
</li>
<li id="nav-Customer">
<a href="/otrs/index.pl?Action=AgentTicketCustomer;TicketID=REDACTED" class="AsPopup PopupType_TicketAction" title="Change the customer for this ticket">Customer</a>
</li>
</ul>
尝试document.getElementById("nav-Customer").click();
没有打开应该在鼠标点击时激活的弹出窗口。
我尝试了这个脚本与常规按钮,它的工作原理。但我在这个特殊情况下需要它。
有人能帮我吗?我做错了什么?(我没有Javascript经验)
你可以这样做:
$(document).ready(function(e) {
$('body').on('click', '#nav-Customer', function(e) {
// do something after click
// comment out to stop debug
console.log("something was clicked");
alert("You Clicked the Link");
});
});
- 检查文件是否准备好
- onclick
#nav-Customer
做某事