event.currentTarget在Chrome上未定义

时间:2018-01-25 09:42:42

标签: javascript html salesforce-lightning

我试图在我的javascript代码中点击该元素的属性值,但由于某种原因,我得到的值是未定义的。

这是代码:

HTML:

select *, case when (count(*) over (partition by name)) = 2 then '3 & 4' 
          else cast(services as varchar) + ' Only' end
from t

JS:

<c:button buttonLabel="Skype" buttonClass="valmetSecondaryButton noMargin" id="I_WANT_THIS_VALUE" onclick="{!c.openSkype}"/>

这适用于Internet Explorer,尚未在Firefox中测试,但未在Chrome中运行。也正如你所知,我正在使用Lightening Component,Salesforce!

1 个答案:

答案 0 :(得分:0)

问题解决了:

<span id="{!v.teamMember.email}" onclick="{!c.openSkype}">
                        <c:button buttonLabel="Skype" buttonClass="valmetSecondaryButton noMargin"/>
</span>

感谢大家对解决这个问题的兴趣!

此链接帮助我解决了问题:https://salesforce.stackexchange.com/questions/160830/lighting-component-get-html-button-id-in-controller-js-working-in-firefox-not

事件冒泡