html5 - Cannot call JavaScript object method from 'onclick' event handler -
i trying call following function onclick event handler of html element, it's not being called:
storesync.close = function () { alert("test"); } here's html part:
<div onclick="storesync.close()"></div> any appreciated. thanks!
you must declare object storesync use inside domelement.
there 2 standard ways that:
var storesync = { close: function() { alert("test"); } } or:
var storesync = {}; storesync.close = function() { alert("test"); } var storesync = { close: function() { alert("test"); } } <div onclick="javascript: storesync.close();">click me!</div>
Comments
Post a Comment