我有一个如下所示的按钮:
autoCompPop.filter(string -> string.toLowerCase().startsWith(autoTF.getText().toLowerCase()));
但是我也在尝试在此按钮内添加Google事件跟踪代码:
<a href="{{ relatedEntry.url }}" data-target="http://go.redirectingat.com/?id=120996X1581244&url={{ affiliateLink|url_encode }}&sref={{ entry.url|url_encode }}" target="_blank" class="btn btn-voucher btn-lg btn-block popunder" onclick="$.popunder(this);">
Reveal Code & Visit<i class="material-icons">chevron_right</i>
</a>
我都添加了,但这似乎打破了困境。
答案 0 :(得分:1)
您可以在触发器上触发2个或更多功能,以分号分隔。
这是一个快速的原型,单击按钮将调用两个单独的功能:
<button onclick="a();b();">Double Action</button>
<div id="a"></div>
<div id="b"></div>
javascript函数:
function a(){
document.getElementById('a').innerHTML ='A';
}
function b(){
document.getElementById('b').innerHTML = 'B';
}
这是工作中的jsFiddle
唯一的问题是第一个函数不会引起阻止调用或处理下一个函数的操作。例如重定向网址或致命异常。