+ 2
How do you call [any] functions in jquery?
I mean like if I have defined a function like this var l; function a(){ l++; } in js I can easy call it in another function by writing a(); but how do you call the same in jquery?
8 Answers
+ 10
With the same way...
+ 10
$(a=function() {
var val = $("p").html();
alert(val);
});
a();
+ 9
They can, I said it's exactly the same...
+ 8
(You shouldn't consider JQuery a different language... It's just an extension of JS.... [A packet of functions...])
+ 8
This is an anonymous function... You cannot call it again if it's not assigned to a variable...
+ 3
alright that answers my question thanksđđđđ
+ 2
but in jquery the functions cannot be given names or can they be given names ?
if( answer == true) {
need_explanation++;
}
+ 2
so look at this code given in one of the lesson's
$(function() {
var val = $("p").html();
alert(val);
});
so what is the name of this function and how do I call it in an another function?