jQuery Functions and Selectors 1/13

上一篇 / 下一篇  2015-08-24 19:54:07 / 个人分类:JavaScript

Functions, Part I: $(document).ready

Functions are the basic unit of action in jQuery. The main entry point of most jQuery applications is a block of code that looks like this:

$(document).ready(function(){Do something
});

Let's go through it bit by bit.

  • $(document) is a jQuery object. The $() is actually a function in disguise; it turns the document into a jQuery object.
  • .ready() is a type of function; you can think of it as sort of a helper that runs the code inside its parentheses as soon as the HTML document is ready.
  • function(){} is the action that .ready() will perform. as soon as the HTML document is loaded. (In the above example, the Dosomething placeholder is where those actions would go.)
  • Instructions:
  • Practice makes perfect! Set up your jQuery code in the script.js tab with $(document).ready() and pass it a function that will immediately hide the orange div on the Result tab. (You can use the jQuery .hide() effect to do this.)

TAG:

wilber.shinobi的个人空间 引用 删除 wilber.shinobi   /   2015-10-29 13:49:29
1. Eat as much as you can each meal
        2. Set up alarm between each 2 hour to eat dessert
        3. 4 days work-out per week, not every day exercise
        4. Compound exercises
 

评分:0

我来说两句

Open Toolbar