I have a very low click handler: $ (document) .on (' Click ',' .xxxbtn ', function (e) {....}) I want to save one of the cookies in some of them. I can write down like this: function default handler (e, callback) {callback (e); DoSomeJobs (); } $ (Document) .on ('click', '.xxxbtn', defaultHandler (e, function (e) {`different code in each BTN .... ....}) But I think it should be handled well ( just look better and clear ): $ (document) .on ( 'Click', ' update m Maybe my example is a bit unclear. I mean if i can create defaultHandler as function statement in javascript? Just function short answser : No, there is no way to say defaultHandler (e) {...} Long answer : It is possible to achieve something like this: order functions, functions which return the function ns. Yes In JS, such a thing is possible, and even clean, short codes are required to be written. First of all, start with a simple ex...
Comments
Post a Comment