Git Product home page Git Product logo

jquery's Introduction

In this repository i will practice jQuery Basics, Events, Effects, HTML, Traversing, Ajax etc.

Table of Contents

What is jQuery?

jQuery is a lightweight, "write less, do more", JavaScript library.

The purpose of jQuery is to make it much easier to use JavaScript on your website.

jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code.

jQuery also simplifies a lot of the complicated things from JavaScript, like AJAX calls and DOM manipulation.

The jQuery library contains the following features:

  • HTML/DOM manipulation
  • CSS manipulation
  • HTML event methods
  • Effects and animations
  • AJAX
  • Utilities

Google CDN

https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js

Basic Syntax

$(document).ready(function(){

    // jQuery methods go here...

});

Advance Selectors

SL Selector Description
1 $(*) * is a universal operator
2 $("ul li") Here ul is parent and li is child
3 $(".abc, .xyz") Multiple Classes
4 $("h1, div, p") Multiple Tags
5 $("p:first") Page first p element
6 $("p:last") Page last p element

Mouse Events

SL Event Name Description
1 click() When click target element this method work
2 dblclick() When double click element this method work
3 contextmenu() When right click mouse this method work
4 mouseenter() When You mouse enter target element then this event work
5 mouseleave() When You mouse leave target element then this event work

Keyboard Events

SL Event Name Description
1 keypress() When pressing any keyboard key this event works perfectly ๐Ÿ˜
2 keyup() When pressing any keyboard key with clicked and down the finger, hold key this event fired!
3 keydown() When pressing any keyboard key and getting up your finger on the key then this event run!

Form Events

SL Event Name Description
1 focus() When clicked any form feild this event worked!
2 blur() When focus out target form feild this event worked!
3 change() When change any select option then change() event worked!
4 select() If select form feild any text or data then select() method worked!
5 submit() Submit() method worked when any form submited!

Window Events

Sl Event Name Description
1 scroll() When you scroll window screen then scroll() method worked!
2 resize() When you resize window screen then resize() method worked!
3 load() ! load() method remove jq version > 3, Now it's replace document.ready()
2 unload() ! unload() method remove jq version > 3

Get method

SL Event Name Description
1 text() When you get only element text then you can use text()
2 html() When you can get html() structure of target element then use html() method.
3 attr() attr() use when you can see target element classes, ids, tags etc.
4 val() When you need target element value then you can use val() method.

Class Methods

SL Event Name Description
1 addClass() When you any class in target element then use addClass()
2 removeClass() When you any remove class in target element then use removeClass()
3 toggleClass() toggleClass() are use when toggle target element class.

Jquery-Traversing

jQuery traversing, which means "move through", are used to "find" (or select) HTML elements based on their relation to other elements. Start with one selection and move through that selection until you reach the elements you desire.

The image below illustrates an HTML page as a tree (DOM tree). With jQuery traversing, you can easily move up (ancestors), down (descendants) and sideways (siblings) in the tree, starting from the selected (current) element. This movement is called traversing - or moving through - the DOM tree.

dom-tree

Traversing Up the DOM Tree

Three useful jQuery methods for traversing up the DOM tree are:

jQuery Traversing - Ancestors

  • parent()
  • parents()
  • parentsUntil()
  • closest()

jQuery Traversing - Descendants

  • children()
  • find()

jQuery Traversing - Siblings

  • siblings()
  • next()
  • nextAll()
  • nextUntil()
  • prev()
  • prevAll()
  • prevUntil()

jQuery Traversing - Filtering

  • first()
  • last()
  • eq()
  • filter()
  • not()

jquery's People

Contributors

sujon-ahmed avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.