我想让这个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,但没有用
答案 0 :(得分:2)
添加文档完整的jquery处理程序:
$(document).ready(function(){
showCollectorDialog();
});
此操作将在文档完全加载后立即运行。
答案 1 :(得分:2)
在这里您可以像这样使用jquery进行操作。您可以将其放在html文件的末尾。还可以在html文件的脚本标签中包含jquery cdn。
$(document).ready ( function(){
alert('hello world');
});
或者您可以这样做
function functionName() {
alert('hello world');
}
window.onload = functionName;
答案 2 :(得分:0)
寻找一个简单的答案,现有的谷歌没有任何作用。
无需自定义触发器。 把它放到你的 html 头中,它会触发表单,我刚刚测试过;-)
<script type="text/javascript">
setTimeout(function() {
$('#atlwdg-trigger').trigger('click');
},100);
</script>