I have multiple buttons that should call the OpenPanel function but apparently chrome doesn't like it when I use inline event handlers. Are there any alternatives? Thanks!
Html:
<button id="showBg" class="panelB" onclick="OpenPanel(this)">Btn1</button>
<button id="showNews" class="panelB" onclick="OpenPanel(this)">Btn2</button>
JavaScript:
function OpenPanel(elem){
alert (elem.id);
}
Chrome Error:
Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.
;after OpenPanel(this)?Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.