question 1
$(".active-btn").click(function(e) {
// do 1...
// do 4...
});
$(".active-btn").click(function(e) {
// do 2...
// do 3...
});
I suddenly find this problem
my click event repeats
, but I can actually do these things separately.
although there is no repetition of the two things to be done
is it possible?
question 2
another question: is there any way to put forward the function in js function?
$(".btn").click(function(e) {
switch (type) {
case "a":
// do a
// a.js
break;
case "b":
// do b
// b.js
break;
case "c":
// do c
// c.js
break;
}
});
suppose there are three things to do
can I write three additional js of these three things and then introduce them into them?
is very much like php"s require or include.
introduces different files, but is doing what"s inside the files?
or something with similar effect?
additional questions three
what"s the difference between these two kinds of introduction?