JQuery 2012. 10 Youn-Hee Han

Slides:



Advertisements
Similar presentations
Diego Guidi - DotNetMarche. DOM tree is clunky to use No multiple handlers per event No high-level functions Browser incompatibilities = jQuery to the.
Advertisements

The jQuery library. What is jQuery ? A javascript lightweight library Is very easy to use Is powerful Is cross-browser compatible Downloadable from jQuery.com,
CT-376 jQuery Most popular javascript library today Latest version:
JQuery CS 380: Web Programming. What is jQuery? jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling,
JQuery A Javascript Library Hard things made eas(ier) Norman White.
CS7026 jQuery Events. What are Events?  jQuery is tailor-made to respond to events in an HTML page.  Events are actions that can be detected by your.
Vishal Kumar 06131A1258. Why you’re going to love jQuery!
Computer Information System Information System California State University Los Angeles Jongwook Woo CIS 461 Web Development I JQuery Part I Jongwook Woo,
CS428 Web Engineering Lecture 15 Introduction to Jquery.
JQuery. What is jQuery? jQuery is a fast, small, and feature-rich JavaScript library that simplifies HTML document traversing and manipulation event handling.
Philly.NET Hands-On jQuery + Plug-ins Bill Wolff, Rob Keiser.
Fundamentals, DOM, Events, AJAX, UI Doncho Minkov Telerik Corporation
Definition from Wikipedia.  The Prototype JavaScript Framework  implemented as a single file of JavaScript code  named prototype.js (
JQuery CS 268. What is jQuery? From their web site:
M. Taimoor Khan Courtesy: Norman White.
PhpXperts What is jQuery Javascript Library Fast and concise Simplifies the interaction between HTML and JavaScript.
Nguyen Ich Cuong.  Course duration: 45’  Purpose: Present Introduction to JQuery  Targeted attendees: NICorp Trainee  Tests/quiz: Yes - 10’
What is jQuery?  JavaScript Library  Functionality  DOM scripting & event handling  Ajax  User interface effects  Form validation 2.
By Jon Marozick.  JavaScript toolkit  Aims to change the way developers think  jQuery philosophy  Find some HTML  Do something to it.
JQuery March 09 th,2009 Create by
JQuery 10/21. Today jQuery Some cool tools around the web JavaScript Libraries Drawing libraries HTML Frameworks Conventions.
JQuery Adding behaviour…. Lecture Plan Review of last lesson Adding behaviour –click, mouseover Animation –fade, slideDown Navigation –parent, find, next.
Jquery Nasrullah. Jquery jQuery is a JavaScript Library. jQuery greatly simplifies JavaScript programming. jQuery is easy to learn.
INTRODUCTION TO HTML5 Using jQuery with HTML5. Introducing jQuery  Although it is not a part of any W3C or WHATWG specification, jQuery performs an important.
Animation & Effects Using JQuery. What is jQuery? jQuery is a lightweight, JavaScript library. The purpose of jQuery is to make it much easier to use.
. Taught by: Muhammad Ali Baloch midahot. WHAT IS JQUERY JQuery is a fast, small, and feature-rich JavaScript library. Simplifies the interaction between.
CHAPTER 5 jQuery อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Unleash the Power of jQuery Doncho Minkov Telerik Software Academy academy.telerik.com Senior Technical Trainer
JQuery Introduction © Copyright 2014, Fred McClurg All Rights Reserved.
LOGO sparcs.org 1 jQuery Tutorial Presenter ㅎㅇㅎㅇ.
Browser scripting jQuery Edited by: Trần Thị Mỹ Dung Ref:w3schools.com.
JavaScript Library. What is jQuery jQuery is a lightweight JavaScript library. The purpose is to make it easier to use JavaScript code on your website.
Unleash the Power of jQuery Learning & Development Team Telerik Software Academy.
JQuery JavaScript is a powerful language but it is not always easy to work with. jQuery is a JavaScript library that helps with: – HTML document traversal.
Web Programming Language Week 9 Dr. Ken Cosh Introducing jQuery.
JQuery Overview Unleash the Power of jQuery SoftUni Team Technical Trainers Software University
Intro to jQuery. What is jQuery? A JavaScript library Lightweight (about 31KB for the minified version) Simplifies HTML document traversing (DOM), event.
IS2802 Introduction to Multimedia Applications for Business Lecture 07: Introduction to jQuery Rob Gleasure
Unit 13 –JQuery Basics Instructor: Brent Presley.
Introduction to jQuery. 2 Objectives When you complete this chapter, you will be able to: Select elements using jQuery syntax Use built-in jQuery functions.
Web Technologies Lecture 8 JQuery. “A fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax.
Introduction to JQuery COGS 187A – Fall JQuery jQuery is a JavaScript library, and allows us to manipulate HTML and CSS after the page has been.
CHAPTER 7 JQUERY WHAT IS JQUERY? jQuery is a script. It is written in JavaScript.
KAPITA SELEKTA INFORMATIKA Lasmedi Afuan, ST.M.Cs.
Selectors & Events. What do Selectors do? What do Selectors do? Selectors allow you to manipulate DOM elements as a group or as a single node. This allows.
JQuery Tutorial. What is jQuery jQuery is a JavaScript Library The purpose of jQuery is to make it much easier to use JavaScript on your website JavaScript.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
JQuery The Write Less, Do More, JavaScript Library.
.. WHAT IS JQUERY JQuery is a fast, small, and feature-rich JavaScript library. Simplifies the interaction between HTML and JavaScript. The jQuery library.
JQuery is a fast, small, and feature-rich javascript library. It makes things like HTML document traversal and manipulation, event handling, animation,
JQuery Element & Attribute Selectors, Events, HTML Manipulation, & CSS Manipulation.
JQuery.
What is jQuery?.
-By Yogita Nirmal.
Tek Raj Chhetri Code for Humans not for machine.
jQuery A Javascript Library Hard things made eas(ier)
CGS 3066: Web Programming and Design Spring 2017
Introduction to Web programming
JQuery Basics 소속 / 작성자 이 문서는 나눔글꼴로 작성되었습니다. 설치하기.
JQUERY Online TRAINING AT GOLOGICA
The Cliff Notes Version
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
JQuery with ASP.NET.
jQuery A Javascript Library Hard things made eas(ier)
Web Programming Language
..
E-commerce Applications Development
Document Object Model.
Web Programming Language
Presentation transcript:

JQuery Youn-Hee Han

jQuery is a lightweight, open-source JavaScript library that simplifies interaction between HTML and JavaScript It was and still being developed by John Resig from Mozilla and was first announced in January 2006

What is jQuery?  jQuery is a library of JavaScript Functions. –"write less, do more“ –Cross-browser support –CSS-like syntax – easy for developers/non-developers to understand –Active developer community –Extensible - plugins  Features –HTML element selections –HTML element manipulation –CSS manipulation –HTML event functions –JavaScript Effects and animations –HTML DOM traversal and modification –AJAX

Adding the jQuery Library to Your Pages  Getting Started – 직접 다운로드 받아 사용 ( –CDN Hosted jQuery Google – 항상 최신버전으로 …

Adding the jQuery Library to Your Pages  Getting Started – 동작 확인을 위한 예제 $(document).ready(function(){ $("button").click(function(){ $("p").toggle(); }); This is a heading This is a paragraph. This is another paragraph. Click me $(document).ready(function() { … }); $(function() { … });

jQuery Syntax  The jQuery syntax is tailor made for selecting HTML elements and perform some action on the element(s). –Basic syntax is: jQuery(selector).action() or $(selector).action() “dollar sign” define jQuery “selector”  query Javascript object or find HTML elements jQuery action()  performed on the element(s) Ex. CSS class ‘notLong’ 를 가진 div element 들을 숨기고 ‘removed’ 라는 CSS class 를 추가 –JQeury Selector 및 함수 정리 $("div.notLong").hide().addClass("removed");

jQuery Selectors  jQuery Element Selectors –CSS 셀렉터와 거의 유사 –$("p") selects all elements. –$("p.intro") selects all elements with class="intro" –$("p#demo") selects all elements with id="demo"  jQuery Attribute Selectors –$("[name]") select all elements with a “name” attribute –$("[name='#']") select all elements with a “name” value equal to "#“ –$("[name*='abc']") select all elements with a “name” value containing the given substring ‘abc’ –$("[name!='#']") select all elements with a “name” value NOT equal to "#" –$("[name$='.jpg']") select all elements with a “name” value that ends with ".jpg“ –$("[name^=‘news']") select all elements with a “name” value beginning exactly with a given string ‘news’

jQuery Selectors  Example $('input[name$="letter"]').val('a letter'); $('input[name*="man"]').val('has man in it!');

jQuery Selectors Yes, jQuery implements CSS Selectors!

jQuery Selectors label 엘리먼트와 동일한 레벨에 존재하는 형제 엘리먼트 input #content 를 ID 로 지니는 엘리먼트 와 동일한 레벨에 존재하는 모든 형제 엘리먼트 div  Combination of Selectors  Hierarchy Selectors

jQuery Selectors  Selection Index Filters –:first-child –:last-child  Visibility Filters

jQuery Selectors  Example span { color:#008; } span.sogreen { color:green; font-weight: bolder; } John, Karl, Brandon Glen, Tane, Ralph $("div span:first-child").css("text-decoration", "underline").hover(function () { $(this).addClass("sogreen"); }, function () { $(this).removeClass("sogreen"); });

jQuery Selectors  Attribute Filters  Forms Selectors

jQuery Selectors  Forms Filters –Ex. Find Dropdown Selected Item Tel-Aviv Yavne Raanana … document.write($("select[name='cities'] option:selected").val());

jQuery Selectors  A Selector returns a pseudo array of jQuery objects –It returns number of selected elements.  Getting a specific DOM element –They return a 2nd DOM element of the selection

jQuery Selectors  “each(fn)” traverses every selected element calling fn() –“this” – is a current DOM element  “each(fn)” also passes an indexer –$(this) : convert the current DOM element to jQuery object –i : index of the current element

jQuery Selectors  Get Part of Selected Result

jQuery Selectors  Traversing DOM elements  Check for expression

jQuery Selectors 총정리  jQuery 가 지원하는 CSS selector

jQuery Selectors 총정리  jQuery 가 지원하는 위치 기반 selector

jQuery Selectors 총정리  jQuery 정의 filter selector

jQuery Events  jQuery Event Function –$("button").click(function() {..some code... } )  Examples Event MethodDescription $(document).ready(function) Binds a function to the ready event of a document (when the document is finished loading) $(selector).click(function) Triggers a function to the click event of selected elements $(selector).dblclick(function) Triggers a function to the double click event of selected elements $(selector).focus(function) Triggers a function to the focus event of selected elements $(selector).mouseover(function) Triggers a function to the mouseover event of selected elements

jQuery Events  bind(eventType, handler) –element 에 지정한 eventType 에 대한 handler 를 설정  one(eventType, handler) –element 에 지정한 eventType 에 대한 handler 를 설정하되, 한 번 실행 후 삭제  unbind(eventType, handler), unbind(event) –element 에 설정된 handler 를 선택적으로 제거  more events.. – $('img').bind('click', function(){alert('Hi there!');}); $('#thing1').bind('click', someListener); $('#thing2').bind('click', someOtherListener);... $('#thing2').unbind('click');

jQuery Effects  jQuery Effects –Hide, Show, Toggle, Slide, Fade, and Animate  more effects.. – – FunctionDescription $(selector).hide()Hide selected elements $(selector).show()Show selected elements $(selector).toggle()Toggle (between hide and show) selected elements $(selector).slideDown()Slide-down (show) selected elements $(selector).slideUp()Slide-up (hide) selected elements $(selector).slideToggle()Toggle slide-up and slide-down of selected elements $(selector).fadeIn()Fade in selected elements $(selector).fadeOut()Fade out selected elements $(selector).fadeToggle()Toggle fade-in and fade-out of selected elements

jQuery HTML Manipulation  Getting or Changing HTML Content –$(selector).html() get the contents of matching HTML elements –$(selector).html(content) The html() method changes the contents (innerHTML) of matching HTML elements ex) $("p").html("W3Schools"); –$(selector).text() get the text contents of matching HTML elements –$(selector).text(content) This method escapes the string provided as necessary so that it will render correctly in HTML. Demonstration Box list item 1 list item 2 $('div.demo-container').text(' This is a test. ') <p>This is a test.</p>

jQuery HTML Manipulation  Adding HTML content –$(selector).append(content) The append() method appends content to the inside of matching HTML elements. –$(selector).prepend(content) The prepend() method "prepends" content to the inside of matching HTML elements. –$(selector).insertAfter(content)  more HTML manipulation.. – $("p").insertAfter(“div");

jQuery CSS Manipulation  jQuery css() Method –css(name) - Return CSS property value $(this).css("background-color");  this 로 선택된 개체의 bgcolor 값 –css(name,value) - Set CSS property and value $("p").css("background-color", "yellow");  모든 p 의 bgcolor 를 yellow 로 변경 –css({properties}) - Set multiple CSS properties and values $("p").css({"background-color": "yellow", "font-size": "200%"});  Size manipulation –height() $("#div1").height("200px"); –width() $("#div2").width("300px");  more CSS manipulation… –

Immediately-Invoked Func­tion  self-invoking anonymous function –It passes “window.jQuery” into that function as argument –It makes $ an alias to window.jQuery (original jQuery Object) –It ensures that the $ will always refer to the jQuery object inside that function, no matter if other library has taken $ as other thing. –Don’t make browsers complain by throwing an warning (or error) (function ($) { })(window.jQuery) !(function ($) { })(window.jQuery) or ;(function ($) { })(window.jQuery)