Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jQuery newbie doubts

 
Nakataa Kokuyo
Ranch Hand
Posts: 189
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day,

could anyone here please enlighten me what is "function ()" means from below ?



Thank you !
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a function literal, also known as an inline function or an anonymous function. It creates a new unnamed function.


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, there's a more commonly used shortcut for creating a ready handler, and that's to pass an inline function to the $ function:

 
Nakataa Kokuyo
Ranch Hand
Posts: 189
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear ! another questions, how can i call the inner function "mytest" from input like button and other ?

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd recommend you take some time and do a little reading. Here, for example. This will answer a lot of these "jQuery 101" type questions. Bear's book is also a great read if you can pick it up.


Or better yet

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic