jQuery: The Basics
This is a basic tutorial, designed to help you get started using jQuery. If you don't have a test page setup yet, start by creating a new HTML page with the following contents:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Demo</title>
</head>
<body>
<a href="http://jquery.com/">jQuery</a>
<script src="jquery.js"></script>
<script>
</script>
</body>
</html>
Complete Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery demo</title>
</head>
<body>
<a href="http://jquery.com/">jQuery</a>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("a").click(function(event){
alert("As you can see, the link no longer took you to jquery.com");
event.preventDefault();
});
});
</script>
</body>
</html>
CALLBACK AND FUNCTIONS
A callback is a function that is passed as an argument to another function and is executed after its parent function has completed. The special thing about a callback is that functions that appear after the "parent" can execute before the callback executes. Another important thing to know is how to properly pass the callback. This is where I have often forgotten the proper syntax.
Callback without arguments
For a callback with no arguments you pass it like this:
$.get('myhtmlpage.html', myCallBack);
Callback with arguments
$.get('myhtmlpage.html', function(){
myCallBack(param1, param2);
});
分享到:
相关推荐
jquery基础教程中文版2015
jQuery基础教程笔记jQuery基础教程笔记jQuery基础教程笔记jQuery基础教程笔记
jquery基础教程第四版源码,帮助学习jquery
《jQuery基础教程(第4版)》是jQuery经典技术教程的最新升级版,涵盖jQuery 1.10.x和jQuery 2.0.x。本书前6章以通俗易懂的方式讲解了jQuery的核心组件,包括jQuery的选择符、事件、动画、DOM操作、Ajax支持等。第7...
jQuery基础教程(第四版)中文pdf版+配套源码
jQuery基础教程第5章中文版,经典的jQuery学习丛书
jQuery基础教程(第二版)源码
jQuery基础教程(第四版)中文 jQuery基础教程(第四版)中文 jQuery基础教程(第四版)中文 jQuery基础教程(第四版)中文 jQuery基础教程(第四版)中文
详细的jquery基础知识总结 jQuery
jQuery基础入门pp
Learning jQuery Jquery基础教程(第二版)
JQuery基础教程之第七章后续章节看我后续资源jquery全套教程: JQuery基础教程之前言和前三章:http://download.csdn.net/source/745869 JQuery基础教程之第四章:http://download.csdn.net/source/745907 JQuery基础...
jQuery基础教程源码 第三版 learning jQuery third edition
JQuery基础教程之第八章后续章节看我后续资源jquery全套教程: JQuery基础教程之前言和前三章:http://download.csdn.net/source/745869 JQuery基础教程之第四章:http://download.csdn.net/source/745907 JQuery基础...
JQuery基础教程 英文原版 高清
JQuery基础教程之第五章后面章节请看我后续资源jquery全套教程: JQuery基础教程之前言和前三章:http://download.csdn.net/source/745869 JQuery基础教程之第四章:http://download.csdn.net/source/745907 JQuery...
jQuery基础入门教程,可以随时查询,放到手机方便随时学习。
【练习向】jQuery基础教程第四版章节源码——Book05_jQuery_操作DOM
jquery 基础教程(learning jquery) 绝对完整版 废了九牛二虎之力才找到的 资源非常珍贵 详细精炼地讲解了jquery 非常适合初学者及有经验的开发人员 需要连同part1.rar 一同下载才能解压