$(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. Android控件(一)下拉刷新:SwipeRefreshLayout

    须要注意的是SwipeRefreshLayout以下仅仅能够有一个直接子节点. 布局文件例如以下. <FrameLayout xmlns:android="http://schemas ...

  2. ChartConlrol二维图表类型

    WinForms Controls >Controls > Chart Control > Concepts > Creating Charts > 2D Chart T ...

  3. C#操作项目配置文件

    前言 对于项目配置文件的读取和修改,.net 提供了ConfigurationManager(位于System.Configuration命名空间) 和WebConfigurationManager( ...

  4. 玩转Android---事件监听篇---第2篇

    事件监听篇---第二篇 下面是各种常用控件的事件监听的使用 ①EditText(编辑框)的事件监听---OnKeyListener ②RadioGroup.RadioButton(单选按钮)的事件监听 ...

  5. ORACLE 查询表定义

    很多文章使用DESC tablename查看,这是查看的表结构,不是表定义. 如下: 1.set long 99999;  --增大输出缓冲区 2.SELECT dbms_metadata.get_d ...

  6. iOS设计模式解析(五)责任链模式

    责任链模式:使多个对象都有机会处理请求,从而避免发送者和接受者之间发生耦合. 应用场景: 有多个对象可以处理请求,而处理程序只有在运行时才能确定 例如: 英雄联盟中伤害计算,伤害类型分为AP.AD.真 ...

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

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

  8. hql中or的用法(代替union)

    hql中不支持union和unionAll关键字因为在查询出的结果集中无法进行排序.代替union起到相同作用的 是or关键字.在构造hql时考虑使用or代替union产生多个结果集的组合. 详解如下 ...

  9. Android Activity之 setContentView()总结

    从一开始hello world的第一个安卓应用开始,Activity 自动生成,布局自动生成,直接修改布局,在Activity中,findviewById()找到view,然后处理相应的业务逻辑即可, ...

  10. jquery ajax后台向前台传list 前台用jquery $.each遍历list

    $.ajax({ type: 'post', url: xxx.action', dataType: 'text', success: function(data){ var dataObj=eval ...