html - javascript onclick() event not working in chrome for text within div container -
the following not working in chrome, works in ie , firefox:
<div id="removefield" onclick="remove(0);" style="cursor: pointer;">-remove</div>
the remove() function not called. idea why?
remove
member function of dom elements in chrome. in console, can see running:
> document.createelement("div").remove function remove() { [native code] }
in inline event handler, properties (including member functions) of element available top-level variables. inline code run inside with(thiselement)
block. in context of inline event code, identifier remove
refers remove
method of element, not global-scope remove
function.
change function name doesn't collide method names of element, or use window.remove
explicitly.
(modified this previous answer of mine handling similar case start
method in ie.)
Comments
Post a Comment