Skip to content

bariskaraca/jquery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents

$

Selects all elements with given selector.

Parameters

Examples

$("*") // Select all elements in document
$(".class") // Selects all elements with the given class.
$("#id") // Selects a element with the given id.
$("[name=”value”]") // Selects elements that have the specified attribute with a value exactly equal to a certain value.
$("[name]") // Selects elements that have the specified attribute, with any value.
$(".class:eq(index)") // Select the element at index n within the matched set.
$(".class:gt(index)") // Select all elements at an index greater than index within the matched set.
$(".class:lt(index)") // Select all elements at an index less than index within the matched set.
$(".class:odd") // Selects odd elements, zero-indexed.
$(".class:even") // Selects even elements, zero-indexed.

ready

This will also be an instance member, Observable#save.

Parameters

Examples

$(document).ready(function(){
    ...
})

find

Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. Selector can be use same as selectors

Parameters

Examples

$(".class").find(selector)

Returns any $

push

Get the index of the first element in the set of matched elements.

Parameters

Examples

$(".class").push(element) // Add an element to the current set of matched elements.
$(".class").push($(".class")) // Add elements as Jquery ($) object to the current set of matched elements.

Returns $

index

Get the index of the first element in the set of matched elements.

Examples

$(".class").index()

Returns number

addClass

Adds the specified class(es) to each element in the set of matched elements.

Parameters

Examples

$(".class").addClass(className)

Returns any $

hasClass

Determine whether any of the matched elements are assigned the given class.

Parameters

Examples

$(".class").hasClass(className)

Returns boolean

removeClass

Remove a single class or multiple classes from each element in the set of matched elements.

Parameters

Examples

$(".class").removeClass(className)

Returns $

toggleClass

Add or remove one or more classes from each element in the set of matched elements, depending on either the class’s presence or the value of the state argument.

Parameters

Examples

$(".class").toggleClass(className)

Returns $

val

Parameters

Examples

$(".class").val(val) // Set the given value of the all elements in the set of matched elements.
$(".class").val() // Get the current value of the first element in the set of matched elements.

Returns ($ | string)

prop

Add or remove one or more classes from each element in the set of matched elements, depending on either the class’s presence or the value of the state argument.

Parameters

Examples

$(".class").prop(prop) // Get the value of a property for the first element in the set of matched elements.
$(".class").prop(prop, val) // Set a property for the set of matched elements.

Returns ($ | string)

html

Parameters

Examples

$(".class").html(html) // Set the html contents of the all elements in the set of matched elements.
$(".class").html() // Get the html contents of the first element in the set of matched elements.

Returns ($ | string)

attr

Parameters

Examples

$(".class").attr(attr, val) // Set the value of an attribute for the all elements in the set of matched elements.
$(".class").attr(attr) // Get the value of an attribute for the first element in the set of matched elements.

Returns ($ | string)

data

Parameters

Examples

$(".class").data(key, val) // Store arbitrary data associated with the matched elements.
$(".class").data(attr) // Return arbitrary data associated with the first element in the jQuery collection, as set by data() or by an HTML5 data-* attribute.
$(".class").data() // Return all the data stores of the first element in the set of matched elements.

Returns ($ | string)

text

Parameters

Examples

$(".class").text(text) // Set the text contents of the all elements in the set of matched elements.
$(".class").text() // Get the text contents of the first element in the set of matched elements.

Returns ($ | string)

removeAttr

Parameters

Examples

$(".class").removeAttr(attr) // Remove an attribute from each element in the set of matched elements.

Returns ($ | string)

css

Parameters

Examples

$(".class").css(key, value) // Set the computed style properties for all elements in the set of matched elements.
$(".class").css(key) // Get the computed style properties for the first element in the set of matched elements.
$(".class").css({
     propertyName1:propertyValue1,
     propertyName2:propertyValue2
}) // Set the computed style properties for all elements in the set of matched elements.

Returns ($ | string | $)

offset

Examples

$(".class").offset() // Get the current coordinates of the first element, or set the coordinates of every element, in the set of matched elements, relative to the document.

Returns object // {width: width, height: height, left: left, top: top}

append

Parameters

Examples

$(".class").append(element) // Insert content, specified by the parameter, to the end of each element in the set of matched elements.

Returns $

appendTo

Parameters

Examples

$(".class").appendTo(element) // Insert every element in the set of matched elements to the end of the target.

Returns $

after

Parameters

Examples

$(".class").after(element) // Insert content, specified by the parameter, after each element in the set of matched elements.

Returns $

before

Parameters

Examples

$(".class").before(element) // Insert content, specified by the parameter, before each element in the set of matched elements.

Returns $

prepend

Parameters

Examples

$(".class").prepend(element) // Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.

Returns $

clone

Examples

$(".class").clone() // Create a deep copy of the set of matched elements.

Returns HTMLElement

empty

Examples

$(".class").empty() // Remove all child nodes and text content of the set of matched elements from the DOM.

Returns $

remove

Examples

$(".class").remove() // Remove the set of matched elements from the DOM.

Returns $

on

Attach a handler to an event(s) for the elements.

Parameters

Examples

$(".class").on("click", handler)

Returns $

off

Remove an event(s) handler.

Parameters

Examples

$(".class").off("click")

Returns $

unbind

Remove an event(s) handler.

Parameters

Examples

$(".class").unbind("click", handler)

Returns $

one

Attach a handler to an event(s) for the elements. The handler is executed at most once per element per event type.

Parameters

Examples

$(".class").one("click", handler)

Returns $

trigger

Execute all handlers and behaviors attached to the matched elements for the given event types.

Parameters

Examples

$(".class").trigger("click", options)

Returns $

hover

Bind one or two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.

Parameters

Examples

$(".class").hover(onMouseOver, onMouseOut)

Returns $

submit

Bind an event handler to the “submit” JavaScript event, or trigger that event on an element.

Parameters

Examples

$(".class").submit(handler)

Returns $

reset

Resets the values of all elements in the matched forms

Examples

$(".class").reset()

Returns $

children

Parameters

Examples

$(".class").children(selector) // Get the children of each element filtered by given selector in the set of matched elements.
$(".class").children() // Get the children of each element in the set of matched elements.

Returns $

parents

Parameters

Examples

$(".class").parents(selector) // Get the ancestors of each element filtered by given selector in the current set of matched elements.
$(".class").parents() // Get the ancestors of each element in the current set of matched elements.

Returns $

siblings

Parameters

Examples

$(".class").siblings(selector) // Get the siblings of each element filtered by given selector in the set of matched elements.
$(".class").siblings() // Get the siblings of each element in the set of matched elements.

Returns $

parent

Parameters

Examples

$(".class").parent(selector) // Get the parent of each element filtered by given selector in the current set of matched elements.
$(".class").parent() // Get the parent of each element in the current set of matched elements.

Returns $

closest

Parameters

Examples

$(".class").closest(selector) // For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.

Returns $

serialize

Encode a set of form elements as a string for submission.

Examples

$(".class").serialize()

Returns string

fadeIn

Display the matched elements by fading them to opaque and visibility.

Parameters

  • time number // animation time as miliseconds
  • callback function // callback function fired when animation is done

Examples

$(".class").fadeIn(time, callback)

Returns $

fadeOut

Hide the matched elements by fading them to opaque and visibility.

Parameters

  • time number // animation time as miliseconds
  • callback function // callback function fired when animation is done

Examples

$(".class").fadeOut(time, callback)

Returns $

show

Show the matched elements by fading them to opaque and visibility.

Parameters

  • time number // animation time as miliseconds
  • direction string // "left" for left to right, "top" for top to bottom

Examples

$(".class").show(time, direction)

Returns $

hide

Hide the matched elements by fading them to opaque and visibility.

Parameters

  • time number // animation time as miliseconds
  • direction string // "left" for left to right, "top" for top to bottom

Examples

$(".class").hide(time, direction)

Returns $

toggle

Toggle the matched elements by fading them to opaque and visibility.

Parameters

  • time number // animation time as miliseconds
  • direction string // "left" for left to right, "top" for top to bottom

Examples

$(".class").toggle(time, direction)

Returns $

ajax

An ajax request can be created by using following codes.

Parameters

Examples

example of options
{
 url: URL,
 type: 'POST', // POST or GET
 processData: false,
 contentType: false,
 data: formData,
 headers: { "X-CSRF-TOKEN": $('meta[name="_token"]').attr('content') },
 success: function(response){
     console.log(response);
 },
 error: function(error){
     console.log(error);
 }
}
example of options
{
     url: URL,
     type: 'POST', // POST or GET
     processData: false,
     contentType: false,
     data: formData,
     headers: { "X-CSRF-TOKEN": $('meta[name="_token"]').attr('content') },
}
.then(function(response) {
     console.log(response);
})
.catch(function(error) {
     console.log(error);
});
$.ajax(time, options)

Returns Promise

Releases

No releases published

Packages

No packages published