Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

This document is about Jquery, Study notes of Computer Programming

jQuery is a popular JavaScript library that helps developers write JavaScript code more easily. jQuery is designed to simplify HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery make web development simpler by providing easy-to-use methods for common tasks.

Typology: Study notes

2023/2024

Available from 04/20/2024

srimathi-2
srimathi-2 🇮🇳

5 documents

1 / 103

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
JQuery
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download This document is about Jquery and more Study notes Computer Programming in PDF only on Docsity!

JQuery

jQuery - Introduction

● JavaScript frameworks - client side development ● Frameworks like jQuery - fill gap between standard and nonstandard browsers ● jQuery is leaner, faster loading, loaded with features making JavaScript developer easier ● Now it has become primary driving force for both web development and application development ● One of jQuery’s biggest innovations was its fantastic DOM querying tool using familiar CSS selector syntax (sizzle) ● Another feature that makes jQuery web development very easy and attractive is its support for chained method calls.

● “Write less, do more”

○ Finding some elements (via CSS selectors) and doing

something with them (via jQuery methods) i.e. locate a

set of elements in the DOM, and then do something with

that set of elements.

○ Chaining multiple jQuery methods on a set of elements

○ Using the jQuery wrapper and implicit iteration

jQuery Example:

$('

') .addClass('selected') .attr({ id : 'body', title : 'Welcome to jQuery' }) .text("Hello, World!");

Hello, World

Using jQuery (JS) library on HTML page

There are several ways to start using jQuery on your web site. ● Use the Google-hosted/ Microsoft-hosted content delivery network (CDN) to include a version of jQuery. ● Download own version of jQuery from jQuery.com and host it on own server or local filesystem. Note: All jQuery methods are inside a document-ready event to prevent any jQuery code from running before the document is finished loading (is ready).

Basic syntax for any jQuery function is:

$(selector).action() ● A $ sign is to define/access jQuery ● A (selector) is to “query (or find)” HTML elements in html page ● A jQuery action() is the action to be performed on the selected element(s) Example:

What jQuery can do for you?

● (^) Its simplistic, chainable, and comprehensive API has the capability to completely change the way you write JavaScript ● (^) With the goals of doing more with less code, jQuery really shines in the following areas: ○ (^) jQuery makes iterating and traversing the DOM much easier via its various built-in methods. ○ (^) jQuery makes selecting items from the DOM easier via its sophisticated, built-in, and ubiquitous capability to use selectors, just like you would use in CSS. ○ (^) jQuery makes it easy to add your own custom methods via its simple-to-understand plug-in Architecture. ○ (^) jQuery helps reduce redundancy in navigation and UI functionality, like tabs, CSS, and markup-based pop-up dialogs, animations, and transitions, and lots of other things.

● (^) Other JavaScript frameworks - Yahoo UI, Prototype, SproutCore, Dojo, and so on ● (^) jQuery frameworks erased lined between browsers (comprehensive API for event handling) ● (^) Other issues- cutting edge CSS properties & CSS gradients for example

WHO DEVELOPS JQUERY?

● (^) John Resig ● (^) www.ejohn.org ● (^) resides in Brooklyn, New York ● (^) Chief Software Architect at Khan Academy ● (^) John still helps with defining the direction and goals of the jQuery project, but jQuery has largely been transitioned to a large team of people ● (^) https://jquery.org/team/

Obtaining jQuery

● (^) www.jquery.com ● (^) A compressed production version (for production) ● (^) An uncompressed development version (for development)

Example 1-1.html

Example 1-1.js

Output

Programming Conventions Markup and CSS Conventions ● (^) When selecting id and class names, make sure that they are descriptive and are contained in a namespace. You never know when you might need to combine one project with another— namespaces help you to prevent conflicts. ● (^) When defining CSS, avoid using generic type selectors. Make your CSS more specific. This can also help with preventing conflicts. ● (^) Organize your files in a coherent manner. Group files from the same project in the same folder; separate multiple projects with multiple folders. Avoid creating huge file dumps that make it difficult to locate and associate files.