Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

jQuery%20Interview%20Questions%20and%20Answers

Question: Different ways of using $.connect function in jQuery?
Answer: The syntax of connect function is $.connect(sourceObj/*object*/, sourceFunc/*string*/, callObj/*object*/, callFunc/*string or Func*/)

sourceObj(optional) is the object of the source function to which we want to connect
sourceFunc is the function name to which we want to connect
callObj(optional) is the object which we want to use for the handler function
callFunc is the function that we want to execute when sourceFunc is executed.

Here sourceObj, callObj are optional for the global functions.
suppose if your sourceFunc is global function then no need to pass the sourceObj or you can use null or self
suppose if your callObj is global function then no need to pass the callObj or you can use null or self

ex:
// fun1, fun2 are global functions
1. $.connect('fun1',fun2)
2. $.connect(null,'fun1',fun2)
3. $.connect(self,'fun1',fun2)
4. $.connect('fun1',null,fun2)
5. $.connect('fun1',self,fun2)
6. $.connect(self,'fun1',null,fun2)
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook