JQuery and defining function parameters with $


Can you help explain the difference between the two JQuery functions below.  I realize func1 uses a selector (if I passed an input control) but should it work if I just passed a string or should I use func2 for a string?

function  func1($data)

function  func2(data)
Who is Participating?
David S.Connect With a Mentor Commented:
The only differences between those two functions is their names and the name of their one argument/parameter. The "$" doesn't mean anything special to JavaScript -- it is used for special things by convention only.

I realize func1 uses a selector (if I passed an input control)
What do you mean by "selector"? To quote the Princess Bride, "I do not think it means what you think it means".
Minh Võ CôngCommented:
when the parameter string you should use func2 because if
if use func1 and data is tag (a,p, i ...) results will not be as you would expect
vamail2Author Commented:
Thank you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.