简体   繁体   English

在另一个 onclick div 中带有 Onlick 事件的 Div

[英]Div with Onlick event inside another onclick div

I want to trigger the onclick event to call the function "quickColorChange()" inside the parent div which has also an onlick event called "showColorChange()".我想触发 onclick 事件来调用父 div 内的函数“quickColorChange()”,该函数还有一个名为“showColorChange()”的 onlick 事件。

But if i trie , the showColorChange() function is called.但是如果我尝试,就会调用 showColorChange() 函数。

 <div class="card__image" id="changeStatusColor30013956" onclick="showColorChange('30013956','#dcdcdc'); return false;" data- emplrcd="1" data-id="30013956" data-container="body" data-toggle="tooltip" data-placement="top" title="" style="width:52px!important;background:#dcdcdc" data-original- title="Status" aria-describedby="tooltip85683"> <div style="cursor:pointer;height: 100%;width: 13px;position: absolute;right: 0px;background: black;color: white;font-weight: bold;"> <span style="position: absolute; top: 40%; right: 0; font-size: 20px;">&lt; </span> </div> <div onclick="quickColorChange('rot');event.stopPropagation;" style="border-radius:50%;background- color:#FE0000;width:32px;height:32px;margin-top: 12px;margin-left: 4px;"> </div> <div onclick="quickColorChange('gelb');event.stopPropagation;" style="border-radius:50%;background- color:#E69123;width:32px;height:32px;margin-top: 12px;margin-left: 4px;"> </div> <div onclick="quickColorChange('grün');event.stopPropagation;" style="border-radius:50%;background- color:#6EA046;width:32px;height:32px;margin-top: 9px;margin-left: 4px;"> </div> </div>

try by modifying event.stopPropagation;尝试通过修改event.stopPropagation; with event.stopPropagation();event.stopPropagation();

Put your parameters of the function:把你的函数参数:

showColorChange('30013956','#dcdcdc')

in the javascript instead.而是在 javascript 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM