简体   繁体   中英

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()".

But if i trie , the showColorChange() function is called.

 <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; with event.stopPropagation();

Put your parameters of the function:

showColorChange('30013956','#dcdcdc')

in the javascript instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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