2014.5.4
I know it’s rather rudimentary, but I recently changed the way I wrote jQuery, so here’s a note.
This is how I used to write it until now. When I look back at it later, there are so many parentheses that it’s hard to see.
$('.element').on('mouseover', function(){
//processed here
}).on('mouseout', function(){
//processed here
}).on('click', function(){
//processed here
});
The behavior is the same as the previous writing style, but the writing style is different. I think this way of writing is easier to see because the tabs are more aligned, what do you think?
$('.element').on({
'mouseover': function(){
//processed here
},
'mouseout': function(){
//processed here
},
'click': function(){
//processed here
}
});````