我想让这个 JS 函数从一个按钮变成一个页面加载我正在将 jira 问题收集器集成到我们的网页中。<a href="#" id="myCustomTrigger">Bug Report</a><script type="text/javascript" src=""></script><script type="text/javascript">window.ATL_JQ_PAGE_PROPS = {"triggerFunction": function(showCollectorDialog) {//Requires that jQuery is available! jQuery("#myCustomTrigger").click(function(e) {e.preventDefault();showCollectorDialog();});}};</script>要在页面重新加载时加载我使用了 window.onload 但这没有用
3 回答
浮云间
TA贡献1829条经验 获得超4个赞
添加文档完整的 jquery 处理程序:
$(document).ready(function(){
showCollectorDialog();
});
这将在文档完全加载后立即运行。
ITMISS
TA贡献1871条经验 获得超8个赞
在这里,您可以像这样使用 jquery 来完成它。您可以将它放在 html 文件的末尾。还可以在 html 文件的脚本标记中包含 jquery cdn。
$(document).ready ( function(){
alert('hello world');
});
或者你可以这样做
function functionName() {
alert('hello world');
}
window.onload = functionName;
墨色风雨
TA贡献1853条经验 获得超6个赞
寻找一个简单的答案,现有的谷歌没有任何作用。
不需要自定义触发器。把它放到你的 html 头中,它会触发表单,我刚刚测试过;-)
<script type="text/javascript">
setTimeout(function() {
$('#atlwdg-trigger').trigger('click');
},100);
</script>
添加回答
举报
0/150
提交
取消