如何覆盖aFunction内部 child.js?
我希望子事件监听器在不触发的情况下aFunction触发,我无法修改parent.js.
这甚至可能吗?
索引.html:
<th class="foo">foo
<span class="bar" data-feather="arrow-down"></span>
</th>
父.js:
parent = {
init: function() {
parent.aFunction($('.foo'));
},
aFunction: function(element) {
element.on('click', function() {
alert('foo');
});
}, ...
window.onload = parent.init;
child.js:
$('.bar').on('click', function() {
alert('bar');
});