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 ...
随机推荐
- Android九宫格图片(9.png)的讲解与制作
刚开始学习Android的时候,会见到res/drawable的几个文件里面有*.9.png格式命名的图片文件.起初以为这只是Android素材的一些特殊命名,其实不是.它是能实现图片素材拉伸.收缩不 ...
- poj2387-Til the Cows Come Home dijkstra获得水的问题
Til the Cows Come Home Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 29539 Accepted ...
- windows平台HTTP代理server搭建(CCproxy)
HTTP代理(CCproxy) 一.拓扑图 二.CCproxy的安装和配置 1.安装CCproxy (1)下载CCproxy无线破解版(没破解的都仅仅支持最多三个用户同一时候连接). (2)按说明安装 ...
- 用HtmlLink来改变网站的主题
#region Theme // 注册样式(将主题样式至于通用样式后面) HtmlLink themeCss = new HtmlLink(); themeCss.Href = GetThemeUrl ...
- 修复CefSharp浏览器组件中文输入Bug
概述 最近在win10上开发wpf应用,需要将CefSharp中wpf版本的浏览器组件(版本号v51.0.0)嵌入到应用中,但是发现不支持中文输入,GitHub上有这个问题的描述,参照其提到的方法可以 ...
- PHP中实现异步调用多线程程序代码
本文章详细的介绍了关于PHP中实现异步调用多线程方法,下面我们以给1000个用户发送一封推荐邮件,用户输入或者导入邮件账号了提交服务器执行发送来讲述. 比如现在有一个场景,给1000个用户发送一封推荐 ...
- cordova开发中遇到的一些坑
# 外域的JS被禁止,修改meta标签 <meta http-equiv="Content-Security-Policy" content="default-sr ...
- linux下小记
今天碰到一个问题 记录下 /usr/bin/ld: cannot find ld 和ldconfig的区别 使用makefile编译的时候提示ld提示某个so找不到 当时使用ldconfig查了下 发 ...
- java+android学习路线图
java.android学习路线图 看图之前先按住Ctrl键同时滑动鼠标滚轮
- ueditor 编辑器的配置 实现上传图片---附效果图
由于项目需要,最近使用了ueditor,实现了图片上传功能,在此分享一下遇到的一些问题. 项目使用net+mvc框架搭建,则选择的是NET版本ueditor 编辑器(可去百度官网下载), 下载完成导入 ...