read和onload jquery.val
$(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
value是dom element的属性
jquery与之对应的是val
val() :获得第一个匹配元素的当前值。
val(val):设置每一个匹配元素的值。
所以,代码应该这样写:
赋值:
$("#id")[0].value = "new value";
或者$("#id").val("new value");
或者这样也可以:val = $("#id").attr("value");
read和onload jquery.val的更多相关文章
- jQuery val()方法及valHooks源码解读
val: function( value ) { var hooks, ret, isFunction, elem = this[0]; if ( !arguments.length ) {//无参数 ...
- jquery val() and text().
.val() works on input elements (or any element with a value attribute?) and .text() will not work on ...
- window onload || jquery $()
1.window 的 onload 机制只指定一个函数,且在页面DOM及静态资源加载完之后执行: window.onload = function(){ alert(); } 2.$(document ...
- jQuery——val()、text()、html()
val():获取标签中的value属性的值.带有参数是赋值(类比js中的value属性) text():获取双闭合标签中的文本值.(不识别标签)(类比innerText) html():获取双闭合标签 ...
- jquery val() text() html()的区别
value()主要用在表单元素上,如果其他的元素获取value是通过attract()的方法,text()是获取元素的纯文本,如果text(“content”)就会更改元素的文本内容:html()获取 ...
- 从重置input file标签中看jQuery的 .val() 和 .attr(“value”) 区别
背景: 在清空input file标签选中值时,分别用了以下方法,发现有的对有的错: [√]$("#file")[0].value = ""; [√]$(&qu ...
- 转:VS2008 vs2010中JQUERY智能提醒
第一步: 安装VS 2008 SP1 VS 2008 SP1 在Visual Studio中加了更丰富的JavaScript intellisense支持,对很大部分的JavaScript库加了代码完 ...
- 【总结整理】JQuery基础学习---样式篇
进入官方网站获取最新的版本 http://jquery.com/download/ 中文 https://www.jquery123.com/ <!--JQuery:轻量级的JavaScr ...
- day63-webservice 09.jquery调用ajax
WebService可以有很多种调用方式,除了之前说的,还可以有jquery.拿原生的Ajax做调用,拿jquery怎么调用啊?原生的能调,jquery指定也能调.原生的Ajax是通过网页直接点HTM ...
随机推荐
- C语言---整型字符串转换
C语言提供了几个标准库函数,能够将随意类型(整型.长整型.浮点型等)的数字转换为字符串.下面是用itoa()函数将整数转 换为字符串的一个样例: # include <stdio.h> ...
- eclipse开发c++时cout和endl报错
1.Symbol 'cout' could not be resolved , 选择kepler版本号就不报错了. 2. 下载gdb, ./configure make sudo make inst ...
- Android自己定义组件系列【7】——进阶实践(4)
上一篇<Android自己定义组件系列[6]--进阶实践(3)>中补充了关于Android中事件分发的过程知识.这一篇我们接着来分析任老师的<可下拉的PinnedHeaderExpa ...
- jQuery Custom Selector JQuery自定义选择器
什么是JQuery的选择器呢,详见JQuery中的Selector: http://docs.jquery.com/Selectors 比如 $("div:contains('John')& ...
- 如何一步步把网站Retina优化
随着高清屏幕.高分辨率屏幕越来越流行,例如MacBook Retina机型.iPad Air系列,这些新生机器有着很高的PPI,对网页的清晰度要求很高,所以越来越多的站长都不得不面临一个问题,那就是把 ...
- virtual private catalog
The following databases are registered in the base recovery catalog: PROD1, PROD2, and PROD3.The dat ...
- linode最新试用(购买)流程
最新linode官网www.linode.com可以免费试用7天,但是需要你的身份认证 第一步:注册一个linode账号email填写国内的163.126.qq邮箱是不能认证的,这里可以填写gmail ...
- elegant 的长整数加法 string 实现
string strAdd(string &v1, string &v2){ string res = ""; ; int len1 = v1.size(), le ...
- 2013ACM-ICPC亚洲区南京站现场赛G题
题目大意:一个n维的系统中随机选一个向量(X1,X2,X3,...,Xn),其中0<=Xi<=R,且X1^2+X2^2+X3^2+……+Xn^2 <= R^2. 现在给定n,R.求X ...
- sql update小结
以前update用的不少,但都是简单的单表操作,没有在意,最近查阅多表关联更新及更新top n,发现update还真灵活,记录如下(在mssqlserver2008r2下测试通过): 1单表操作 u ...