$(document).load();

当web页面以及其附带的资源文件,如CSS,Scripts,图片等,加载完毕后执行此方法。
常用于检测页面(及其附带资源)是否加载完毕。

$(document).ready();
当页面DOM对象加载完毕,web浏览器能够运行JS时,此方法即被触发。如果你想尽快执行JS,可以使用此方法。[在html的头部的script标签中的,不处于ready()中的JS代码将早于ready()执行]

$(document).unload();
此事件在停止浏览页面的时候触发,此操作可能存在于刷新操作/F5,单击上一页按钮,进入其他页面或关闭整个tab或窗口。

总而言之,他们的调用顺序是 ready() >> load() >> unload() 。

$(document).load();

Will execute after the page along with all its contents are done loading. This means that all images, CSS (and content defined by CSS like custom fonts and images), scripts, etc. are all loaded. This happens event fires when your browser's "Stop" -icon becomes gray, so to speak. This is very useful to detect when the document along with all its contents are loaded.

$(document).ready();

This on the other hand will fire as soon as the web browser is capable of running your JavaScript, which happens after the parser is done with the DOM. This is useful if you want to execute JavaScript as soon as possible.

$(document).unload();

This event will be fired when you are navigating off the page. That could be Refresh/F5, pressing the previous page button, navigating to another website or closing the entire tab/window.

To sum up, ready() will be fired before load(), and unload() will be the last to be fired.

http://stackoverflow.com/questions/2683072/jquery-events-load-ready-unload

以上转自:http://blog.csdn.net/after2010/article/details/9037069

刚开始接触jquery,很多东西不熟悉在用$("#id")来获得页面的input元素的时候,发现$("#id").value不能取到值
 
后来终于在伟大的百度帮助下,找到了问题的原因:

复制代码代码如下:
$("")是一个jquery对象,而不是一个dom element 
value是dom element的属性 
jquery与之对应的是val 
val() :获得第一个匹配元素的当前值。 
val(val):设置每一个匹配元素的值。 

所以,代码应该这样写:

复制代码代码如下:
取值:val = $("#id")[0].value; 
赋值: 
$("#id")[0].value = "new value"; 
或者$("#id").val("new value");

或者这样也可以:val = $("#id").attr("value");

read和onload jquery.val的更多相关文章

  1. jQuery val()方法及valHooks源码解读

    val: function( value ) { var hooks, ret, isFunction, elem = this[0]; if ( !arguments.length ) {//无参数 ...

  2. jquery val() and text().

    .val() works on input elements (or any element with a value attribute?) and .text() will not work on ...

  3. window onload || jquery $()

    1.window 的 onload 机制只指定一个函数,且在页面DOM及静态资源加载完之后执行: window.onload = function(){ alert(); } 2.$(document ...

  4. jQuery——val()、text()、html()

    val():获取标签中的value属性的值.带有参数是赋值(类比js中的value属性) text():获取双闭合标签中的文本值.(不识别标签)(类比innerText) html():获取双闭合标签 ...

  5. jquery val() text() html()的区别

    value()主要用在表单元素上,如果其他的元素获取value是通过attract()的方法,text()是获取元素的纯文本,如果text(“content”)就会更改元素的文本内容:html()获取 ...

  6. 从重置input file标签中看jQuery的 .val() 和 .attr(“value”) 区别

    背景: 在清空input file标签选中值时,分别用了以下方法,发现有的对有的错: [√]$("#file")[0].value = ""; [√]$(&qu ...

  7. 转:VS2008 vs2010中JQUERY智能提醒

    第一步: 安装VS 2008 SP1 VS 2008 SP1 在Visual Studio中加了更丰富的JavaScript intellisense支持,对很大部分的JavaScript库加了代码完 ...

  8. 【总结整理】JQuery基础学习---样式篇

    进入官方网站获取最新的版本 http://jquery.com/download/    中文 https://www.jquery123.com/ <!--JQuery:轻量级的JavaScr ...

  9. day63-webservice 09.jquery调用ajax

    WebService可以有很多种调用方式,除了之前说的,还可以有jquery.拿原生的Ajax做调用,拿jquery怎么调用啊?原生的能调,jquery指定也能调.原生的Ajax是通过网页直接点HTM ...

随机推荐

  1. 开源 java CMS - FreeCMS2.3 移动app生成首页数据

    原文地址:http://javaz.cn/site/javaz/site_study/info/2015/28160.html​ 项目地址:http://www.freeteam.cn/ 生成首页数据 ...

  2. Trie树-脏词过滤应用

    Trie树,又称字符查找树.前缀树,主要用于字符匹配(详见http://en.wikipedia.org/wiki/Trie).适合做关键词查找,比如查找文章中的关键字然后给他们加链接. 当然对脏词的 ...

  3. C#中byte[] 与指针

    本文假定读者熟悉byte[].指针. C#是类型安全的,默认是不允许使用指针,但是针对C\C++或者其他语言的程序员(delphi)转为使用C#的的工作人员,不适用指针觉得很别扭.下面介绍一下基础的指 ...

  4. [Linked List]Reverse Nodes in k-Group

    Total Accepted: 48614 Total Submissions: 185356 Difficulty: Hard Given a linked list, reverse the no ...

  5. [Linked List]Delete Node in a Linked List

    otal Accepted: 48115 Total Submissions: 109291 Difficulty: Easy Write a function to delete a node (e ...

  6. c++多线程参数的传递

    #include <iostream> #include <pthread.h> //多线程相关操作头文件,可移植众多平台 using namespace std; struc ...

  7. MySQL如何使用索引 较为详细的分析和例子

    在数据库表中,使用索引可以大大提高查询速度. 假如我们创建了一个 testIndex 表: CREATE TABLE testIndex(i_testID INT NOT NULL,vc_Name V ...

  8. js:关于IE6/7下new Date(值)输出为NaN的解决方案

    不得不再次说,万恶的IE,你太守旧了吧,这里出错的原因是IE的时间格式,不是2012-01-23(很多人喜欢用这样的格式) 而是2012/01/23(怎么感觉像是在用VB6和access啊) 搞了好久 ...

  9. Python 自带IDLE中调试程序

    在vs2013下调试过Python,今天试了下使用自带IDLE调试,相比而言后者效果不好. 记录一下 http://q.cnblogs.com/q/35869/ 在“Python Shell”窗口中单 ...

  10. 14-利用SVD简化数据

    参考:http://blog.csdn.net/geekmanong/article/details/50494936 http://www.2cto.com/kf/201503/383087.htm ...