a jquery extend function '$.on' for all eventListener
npm install jquery-onnpm install jquery-on --save or download jquery.on.min.js
jquery.js and jquery.on.min.js in your html file
aaaaaaa
1
2
`
- javascript
`
$.on({
window: {
scroll: function(event) {
console.log('window scroll');
}
},
'#a': {
click: function(event) {
console.log('a click');
},
dblclick: function(event) {
console.log('a dblclick');
}
},
'#b': {
'input change': function(event) {
console.log('b input or change');
}
},
'.li': {
parent: '#ul', // Event Delegation
click: function(event) {
console.log('li click');
}
}
});
``