Core
$(html)

$(html)

Create DOM elements on-the-fly from the provided String of raw HTML.

Cria elementos DOM por cima da String fornecida do HTML.

Returns - Retornos

jQuery

Parameters - Parâmetros

  • html (String): A string of HTML to create on the fly.
  • html (String): (String): Uma String do HTML para criar por cima.

Example - Exemplo

Creates a div element (and all of its contents) dynamically, and appends it to the element with the ID of body. Internally, an element is created and it's innerHTML property set to the given markup. It is therefore both quite flexible and limited.

Cría um elemento div (e todo seu conteúdo) dinâmicamente, e adiciona-os ao elemento com o ID do Body. Internamente, um elemento é criado e a propriedade do innerHTML põe ao alvo fornecido. É conseqüentemente ambos completamente flexíveis e limitados.

jQuery Code - código do jQuery

$("<div><p>Hello</p></div>").appendTo("#body")
$(elems)

$(elems)

Wrap jQuery functionality around a single or multiple DOM Element(s).

This function also accepts XML Documents and Window objects as valid arguments (even though they are not DOM Elements).

Funcionalidade jQuery de envolver um único ou múltiplos elementos de DOM.

Esta função aceita Documentos XML e um leque de objetos válidos (mesmo que não sejam elementos DOM).

Returns - Retornos

jQuery

Parameters - Parâmetros

  • elems (Element|Array<Element>): DOM element(s) to be encapsulated by a jQuery object.
  • elems (Element|Array<Element>): (Element|Array): Elementos DOM a envolvidos por um objeto do jQuery.

Example - Exemplo

Sets the background color of the page to black.

Seta a cor do fundo da página para preto.

jQuery Code - código do jQuery

$(document.body).background( "black" );

Example - Exemplo

Hides all the input elements within a form

Esconde todos os elementos que estejam dentro de um formulário

jQuery Code - código do jQuery

$( myForm.elements ).hide()
$(fn)

$(fn)

A shorthand for $(document).ready(), allowing you to bind a function to be executed when the DOM document has finished loading. This function behaves just like $(document).ready(), in that it should be used to wrap all of the other $() operations on your page. While this function is, technically, chainable - there really isn't much use for chaining against it. You can have as many $(document).ready events on your page as you like.

Uma abreviação para $ (document).ready (), permitindo que você acione uma função a ser executada quando o documento DOM terminar o carregamento. Esta função comporta-se justamente como $(document).ready (), que deve ser usado envolvendo todas as outras operações de $() em sua página.

See ready(Function) for details about the ready event.

Ver Funcionando(Function) para detalhes sobre o evento funcionando.

Returns - Retornos

jQuery

Parameters - Parâmetros

  • fn (Function): The function to execute when the DOM is ready.
  • fn(Function): A função para que execute , é necessário o DOM está carregado.

Example - Exemplo

Executes the function when the DOM is ready to be used.

Executa a função quando o DOM estiver carregado e pronto para ser usado.

jQuery Code - código do jQuery

$(function(){
// Document is ready
});

Example - Exemplo

Uses both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias.

Usa o atalho para $ (document).ready() e o argumento escreve o código failsafe do jQuery usando o $ alias, sem confiar no global aliás.

jQuery Code - código do jQuery

jQuery(function($) {
// Your code using failsafe $ alias here...
});
$(expr, context)

$(expr, context)

This function accepts a string containing a CSS or basic XPath selector which is then used to match a set of elements.

The core functionality of jQuery centers around this function. Everything in jQuery is based upon this, or uses this in some way. The most basic use of this function is to pass in an expression (usually consisting of CSS or XPath), which then finds all matching elements.

By default, $() looks for DOM elements within the context of the current HTML document.

Esta função aceita uma corda que contem um CSS ou um seletor básico de XPath que seja usado então combinar um jogo dos elementos.

A funcionalidade do núcleo do jQuery centra-se em torno desta função. Tudo no jQuery é baseado neste, ou usa este em alguma maneira. O uso o mais básico desta função é passar em uma expressão (CSS geralmente consistindo ou XPath), que encontre então todos os elementos combinando.

Pelo defeito, $ () procura elementos de DOM dentro do contexto do original atual do HTML.

Returns - Retornos

jQuery

Parameters - Parâmetros

  • expr (String): An expression to search with
  • context (Element|jQuery): (optional) A DOM Element, Document or jQuery to use as context
  • expr (String): Uma expressão a procurarar com
  • context (Element|jQuery): (opcional) um elemento, original ou jQuery de DOM a usar-se como o contexto

Example - Exemplo

Finds all p elements that are children of a div element.

Encontra todos os elementos de p que são crianças de um elemento do div.

jQuery Code - código do jQuery

$("div > p")

Before - Antes

<p>one</p> <div><p>two</p></div> <p>three</p>

Result - Resultado

[ <p>two</p> ]

Example - Exemplo

Searches for all inputs of type radio within the first form in the document

Buscas para todas as entradas do tipo rádio dentro do primeiro formulário no original

jQuery Code - código do jQuery

$("input:radio", document.forms[0])

Example - Exemplo

This finds all div elements within the specified XML document.

Isto encontra todos os elementos do div dentro do original especificado de XML.

jQuery Code - código do jQuery

$("div", xml.responseXML)
$.extend(prop)

$.extend(prop)

Extends the jQuery object itself. Can be used to add functions into the jQuery namespace and to add plugin methods (plugins).

Estende o objeto próprio do jQuery. Pode ser usado adicionar funções no namespace do jQuery e adicionar métodos plugin (encaixes).

Returns - Retornos

Object

Parameters - Parâmetros

  • prop (Object): The object that will be merged into the jQuery object
  • prop (Objeto): O objeto que será fundido no objeto do jQuery
  • Example - Exemplo

    Adds two plugin methods.

    Adiciona dois métodos plugin.

    jQuery Code - código do jQuery

    jQuery.fn.extend({
    check: function() {
    return this.each(function() { this.checked = true; });
    },
    uncheck: function() {
    return this.each(function() { this.checked = false; });
    }
    });
    $("input[@type=checkbox]").check();
    $("input[@type=radio]").uncheck();

    Example - Exemplo

    Adds two functions into the jQuery namespace

    Adiciona duas funções no namespace do jQuery

    jQuery Code - código do jQuery

    jQuery.extend({
    min: function(a, b) { return a < b ? a : b; },
    max: function(a, b) { return a > b ? a : b; }
    });
    $.noConflict()

    $.noConflict()

    Run this function to give control of the $ variable back to whichever library first implemented it. This helps to make sure that jQuery doesn't conflict with the $ object of other libraries.

    By using this function, you will only be able to access jQuery using the 'jQuery' variable. For example, where you used to do $("div p"), you now must do jQuery("div p").

    Funcionar esta função para dar para trás o controle da variável de $ a qualquer biblioteca a executou primeiramente. Isto ajuda certificar-se de que o jQuery não opõe ao objeto de $ de outras bibliotecas.

    Usando esta função, você somente alcança o jQuery usando a variável do “jQuery”. Por exemplo, onde você se usou fazer $ (“div p”), você agora deve fazer o jQuery (“div p”).

    Returns - Retornos

    undefined

    Example - Exemplo

    Maps the original object that was referenced by $ back to $

    Traça o objeto original que referenced por $ para trás a $

    jQuery Code - código do jQuery

    jQuery.noConflict();
    // Do something with jQuery
    jQuery("div p").hide();
    // Do something with another library's $()
    $("content").style.display = 'none';

    Example - Exemplo

    Reverts the $ alias and then creates and executes a function to provide the $ as a jQuery alias inside the functions scope. Inside the function the original $ object is not available. This works well for most plugins that don't rely on any other library.

    Reverts o $ aliás e então cría e executa uma função para fornecer o $ como um jQuery aliás dentro do espaço das funções. Dentro da função o objeto original de $ não está disponível. Isto trabalha bem para a maioria de encaixes que não confiam em nenhuma outra biblioteca.

    jQuery Code - código do jQuery

    jQuery.noConflict();
    (function($) { 
    $(function() {
    // more code using $ as alias to jQuery
    });
    })(jQuery);
    // other code using $ as an alias to the other library
    each(fn)

    each(fn)

    Execute a function within the context of every matched element. This means that every time the passed-in function is executed (which is once for every element matched) the 'this' keyword points to the specific element.

    Additionally, the function, when executed, is passed a single argument representing the position of the element in the matched set.

    Executar uma função dentro do contexto de cada elemento combinado. Isto significa que cada vez que pass-na função está executado (que é uma vez para cada elemento combinado) “este” keyword aponta ao elemento específico.

    Adicionalmente, a função, quando executada, é passada a um único argumento que representa a posição do elemento no jogo combinado.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to execute
    • fn (Function): Uma função a executar

    Example - Exemplo

    Iterates over two images and sets their src property

    Itera sobre duas imagens e ajusta sua propriedade do src

    jQuery Code - código do jQuery

    $("img").each(function(i){
    this.src = "test" + i + ".jpg";
    });

    Before - Antes

    <img/><img/>

    Result - Resultado

    <img src="test0.jpg"/><img src="test1.jpg"/>
    eq(pos)

    eq(pos)

    Reduce the set of matched elements to a single element. The position of the element in the set of matched elements starts at 0 and goes to length - 1.

    Reduzir o jogo de elementos combinados a um único elemento. A posição do elemento no jogo de elementos combinados começa por 0 e vai ao comprimento - 1.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • pos (Number): The index of the element that you wish to limit to.
    • pos (Number): O índice do elemento a que você deseja limitar.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").eq(1)

    Before - Antes

    <p>This is just a test.</p><p>So is this</p>

    Result - Resultado

    [ <p>So is this</p> ]
    get()

    get()

    Access all matched elements. This serves as a backwards-compatible way of accessing all matched elements (other than the jQuery object itself, which is, in fact, an array of elements).

    Alcançar todos os elementos combinados. Isto serve como uma maneira para trás-compatível de alcançar todos os elementos combinados (à excepção do objeto próprio do jQuery, que é, no fato, em uma disposição dos elementos).

    Returns - Retornos

    Array<Element>

    Example - Exemplo

    Selects all images in the document and returns the DOM Elements as an Array

    Seleciona todas as imagens no original e retorna os elementos de DOM como uma disposição

    jQuery Code - código do jQuery

    $("img").get();

    Before - Antes

    <img src="test1.jpg"/> <img src="test2.jpg"/>

    Result - Resultado

    [ <img src="test1.jpg"/> <img src="test2.jpg"/> ]
    get(num)

    get(num)

    Access a single matched element. num is used to access the Nth element matched.

    Alcançar um único elemento combinado. numérico é usado alcançar o Nth elemento combinado.

    Returns - Retornos

    Element

    Parameters - Parâmetros

    • num (Number): Alcançar o elemento na Nth posição.

    Example - Exemplo

    Selects all images in the document and returns the first one

    Seleciona todas as imagens no original e retorna primeiro

    jQuery Code - código do jQuery

    $("img").get(0);

    Before - Antes

    <img src="test1.jpg"/> <img src="test2.jpg"/>

    Result - Resultado

    [ <img src="test1.jpg"/> ]
    gt(pos)

    gt(pos)

    Reduce the set of matched elements to all elements after a given position. The position of the element in the set of matched elements starts at 0 and goes to length - 1.

    Reduzir o jogo de elementos combinados a todos os elementos após uma posição dada. A posição do elemento no jogo de elementos combinados começa por 0 e vai ao comprimento - 1.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • pos (Number): Reduce the set to all elements after this position.
    • pos (Number): Reduzir o jogo a todos os elementos após esta posição.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").gt(0)

    Before - Antes

    <p>This is just a test.</p><p>So is this</p>

    Result - Resultado

    [ <p>So is this</p> ]
    index(subject)

    index(subject)

    Searches every matched element for the object and returns the index of the element, if found, starting with zero. Returns -1 if the object wasn't found.

    Procurara cada elemento combinado pelo objeto e retorna o índice do elemento, se encontrado, começando com zero. Retorna -1 se o objeto não for encontrado.

    Returns - Retornos

    Number

    Parameters - Parâmetros

    • subject (Element): Object to search for
    • subject (Element): Objeto a procurarar por

    Example - Exemplo

    Returns the index for the element with ID foobar

    Retorna o índice para o elemento com o ID foobar

    jQuery Code - código do jQuery

    $("*").index( $('#foobar')[0] )

    Before - Antes

    <div id="foobar"><b></b><span id="foo"></span></div>

    Result - Resultado

    0

    Example - Exemplo

    Returns the index for the element with ID foo within another element

    Retorna o índice para o elemento com o foo do ID dentro de um outro elemento

    jQuery Code - código do jQuery

    $("*").index( $('#foo')[0] )

    Before - Antes

    <div id="foobar"><b></b><span id="foo"></span></div>

    Result - Resultado

    2

    Example - Exemplo

    Returns -1, as there is no element with ID bar

    Os retornos -1, como lá não são nenhum elemento com barra do ID

    jQuery Code - código do jQuery

    $("*").index( $('#bar')[0] )

    Before - Antes

    <div id="foobar"><b></b><span id="foo"></span></div>

    Result - Resultado

    -1
    length

    length

    The number of elements currently matched.

    O número dos elementos combinou atualmente.

    Returns - Retornos

    Number

    Example - Exemplo

    jQuery Code - código do jQuery

    $("img").length;

    Before - Antes

    <img src="test1.jpg"/> <img src="test2.jpg"/>

    Result - Resultado

    2
    lt(pos)

    lt(pos)

    Reduce the set of matched elements to all elements before a given position. The position of the element in the set of matched elements starts at 0 and goes to length - 1.

    Reduzir o jogo de elementos combinados a todos os elementos antes de uma posição dada. A posição do elemento no jogo de elementos combinados começa por 0 e vai ao comprimento - 1.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • pos (Number): Reduce the set to all elements below this position.
    • pos (Number): Reduzir o jogo a todos os elementos abaixo desta posição.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").lt(1)

    Before - Antes

    <p>This is just a test.</p><p>So is this</p>

    Result - Resultado

    [ <p>This is just a test.</p> ]
    size()

    size()

    The number of elements currently matched.

    O número dos elementos combinou atualmente.

    Returns - Retornos

    Number

    Example - Exemplo

    jQuery Code - código do jQuery

    $("img").size();

    Before - Antes

    <img src="test1.jpg"/> <img src="test2.jpg"/>

    Result - Resultado

    2
    DOM
    Attributes
    addClass(class)

    addClass(class)

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

    Adiciona a classe especificada a cada um dos quadro de elementos combinados.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • class (String): One or more CSS classes to add to the elements
    • class (String): Um ou o mais classes CSS para adicionar aos elementos

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").addClass("selected")

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    [ <p class="selected">Hello</p> ]

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").addClass("selected highlight")

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    [ <p class="selected highlight">Hello</p> ]
    attr(name)

    attr(name)

    Access a property on the first matched element. This method makes it easy to retrieve a property value from the first matched element.

    Alcança uma propriedade no primeiro elemento combinado. Este método facilmente recupera um valor da propriedade do primeiro elemento combinado.

    Returns - Retornos

    Object

    Parameters - Parâmetros

    • name (String): The name of the property to access.
    • name (String): O nome da propriedade a acessar.

    Example - Exemplo

    Returns the src attribute from the first image in the document.

    Retorna o atributo src da primeira imagem do documento.

    jQuery Code - código do jQuery

    $("img").attr("src");

    Before - Antes

    <img src="test.jpg"/>

    Result - Resultado

    test.jpg
    attr(properties)

    attr(properties)

    Set a key/value object as properties to all matched elements.

    A chave/valor junta-se para ajustar-se como propriedades do objeto.

    This serves as the best way to set a large number of properties

    This serves as the best way to set a large number of properties on all matched elements.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • properties (Map): Key/value pairs to set as object properties.

    Example - Exemplo

    Sets src and alt attributes to all images.

    Ajusta o src e os atributos do alt a todas as imagens.

    jQuery Code - código do jQuery

    $("img").attr({ src: "test.jpg", alt: "Test Image" });

    Before - Antes

    <img/>

    Result - Resultado

    <img src="test.jpg" alt="Test Image"/>
    attr(key, value)

    attr(key, value)

    Set a single property to a value, on all matched elements.

    Ajusta uma única propriedade a um valor, em todos os elementos combinados.

    Can compute values provided as ${function}, see second example.

    Pode computar os valores fornecidos como ${function}, vêem o segundo exemplo.

    Note that you can't set the name property of input elements in IE. Use $(html) or .append(html) or .html(html) to create elements on the fly including the name property.

    Note que você não pode ajustar a propriedade conhecida de elementos da entrada no IE. Usar $ (HTML) ou .append(HTML) ou .html (HTML) para criar elementos incluindo a propriedade conhecida.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • key (String): The name of the property to set.
    • key (String): O nome da propriedade a ajustar-se.
    • value (Object): The value to set the property to.
    • value (Object): O valor para ajustar a propriedade a.

    Example - Exemplo

    Sets src attribute to all images.

    Ajusta o atributo src a todas as imagens.

    jQuery Code - código do jQuery

    $("img").attr("src","test.jpg");

    Before - Antes

    <img/>

    Result - Resultado

    <img src="test.jpg"/>

    Example - Exemplo

    Sets title attribute from src attribute, a shortcut for attr(String,Function)

    Ajusta o título do atributo src, um atalho do título para o attr(String,Function)

    jQuery Code - código do jQuery

    $("img").attr("title", "${this.src}");

    Before - Antes

    <img src="test.jpg" />

    Result - Resultado

    <img src="test.jpg" title="test.jpg" />
    attr(key, value)

    attr(key, value)

    Set a single property to a computed value, on all matched elements.

    Ajustar uma única propriedade a um valor computado, em todos os elementos combinados.

    Instead of a value, a function is provided, that computes the value.

    Em vez de um valor, uma função é fornecida, que compute o valor.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • key (String): The name of the property to set.
    • key (String): O nome da propriedade a ajustar-se.
    • value (Function): A function returning the value to set. Scope: Current element, argument: Index of current element
    • value (Function): Uma função que retorna o valor a ajustar. Scope: Elemento atual, argument: Índice do elemento atual

    Example - Exemplo

    Sets title attribute from src attribute.

    Ajusta o atributo do título do atributo do src.

    jQuery Code - código do jQuery

    $("img").attr("title", function() { return this.src });

    Before - Antes

    <img src="test.jpg" />

    Result - Resultado

    <img src="test.jpg" title="test.jpg" />

    Example - Exemplo

    Enumerate title attribute.

    Enumerar o atributo do título

    jQuery Code - código do jQuery

    $("img").attr("title", function(index) { return this.title + (i + 1); });

    Before - Antes

    <img title="pic" /><img title="pic" /><img title="pic" />

    Result - Resultado

    <img title="pic1" /><img title="pic2" /><img title="pic3" />
    html()

    html()

    Get the html contents of the first matched element. This property is not available on XML documents.

    Começar os índices do HTML do primeiro elemento combinado. Esta propriedade não está disponível em documentos XML.

    Returns - Retornos

    String

    Example - Exemplo

    jQuery Code - código do jQuery

    $("div").html();

    Before - Antes

    <div><input/></div>

    Result - Resultado

    <input/>
    html(val)

    html(val)

    Set the html contents of every matched element. This property is not available on XML documents.

    Ajustar os índices do HTML de cada elemento combinado. Esta propriedade não está disponível em documentos XML.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • val (String): Set the html contents to the specified value.
    • val (String): Ajustar os índices do HTML ao valor especificado.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("div").html("<b>new stuff</b>");

    Before - Antes

    <div><input/></div>

    Result - Resultado

    <div><b>new stuff</b></div>
    removeAttr(name)

    removeAttr(name)

    Remove an attribute from each of the matched elements.

    Remover um atributo de cada um dos elementos combinados.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • name (String): The name of the attribute to remove.
    • name (String): O nome do atributo a remover.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("input").removeAttr("disabled")

    Before - Antes

    <input disabled="disabled"/>

    Result - Resultado

    <input/>
    removeClass(class)

    removeClass(class)

    Removes all or the specified class(es) from the set of matched elements.

    Remove tudo ou a classe especificada do quadro de elementos combinados.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • class (String): (optional) One or more CSS classes to remove from the elements
    • class (String): (opcional) um ou mais classes CSS para remover dos elementos.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").removeClass()

    Before - Antes

    <p class="selected">Hello</p>

    Result - Resultado

    [ <p>Hello</p> ]

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").removeClass("selected")

    Before - Antes

    <p class="selected first">Hello</p>

    Result - Resultado

    [ <p class="first">Hello</p> ]

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").removeClass("selected highlight")

    Before - Antes

    <p class="highlight selected first">Hello</p>

    Result - Resultado

    [ <p class="first">Hello</p> ]
    text()

    text()

    Get the text contents of all matched elements. The result is a string that contains the combined text contents of all matched elements. This method works on both HTML and XML documents.

    Começar os índices do texto de todos os elementos combinados. O resultado é uma string que contenha os índices combinados do texto de todos os elementos combinados. Este método trabalha com documentosHTML e XML.

    Returns - Retornos

    String

    Example - Exemplo

    Gets the concatenated text of all paragraphs

    Começa o texto concatenado de todos os parágrafos

    jQuery Code - código do jQuery

    $("p").text();

    Before - Antes

    <p><b>Test</b> Paragraph.</p><p>Paraparagraph</p>

    Result - Resultado

    Test Paragraph.Paraparagraph
    text(val)

    text(val)

    Set the text contents of all matched elements.

    Ajustar os índices do texto de todos os elementos combinados.

    Similar to html(), but escapes HTML (replace "<" and ">" with their HTML entities).

    Similar to html(), but escapes HTML (replace "<" and ">" with their HTML entities). Similar ao html(), mas escapa HTML (substituir "<" and ">" com suas entidades HTML).

    Returns - Retornos

    String

    Parameters - Parâmetros

    • val (String): The text value to set the contents of the element to.
    • val (String): O valor do texto para ajustar os índices do elemento a.

    Example - Exemplo

    Sets the text of all paragraphs.

    Ajusta o texto de todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").text("<b>Some</b> new text.");

    Before - Antes

    <p>Test Paragraph.</p>

    Result - Resultado

    <p>&lt;b&gt;Some&lt;/b&gt; new text.</p>

    Example - Exemplo

    Sets the text of all paragraphs.

    jQuery Code - código do jQuery

    $("p").text("<b>Some</b> new text.", true);

    Before - Antes

    <p>Test Paragraph.</p>

    Result - Resultado

    <p>Some new text.</p>
    toggleClass(class)

    toggleClass(class)

    Adds the specified class if it is not present, removes it if it is present.

    Adiciona a classe especificada se não estiver atual, remove-a se estiver atual.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • class (String): A CSS class with which to toggle the elements
    • class (String): Uma classe do CSS com que para toggle os elementos

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").toggleClass("selected")

    Before - Antes

    <p>Hello</p><p class="selected">Hello Again</p>

    Result - Resultado

    [ <p class="selected">Hello</p>, <p>Hello Again</p> ]
    val()

    val()

    Get the current value of the first matched element.

    Começar o valor atual do primeiro elemento combinado.

    Returns - Retornos

    String

    Example - Exemplo

    jQuery Code - código do jQuery

    $("input").val();

    Before - Antes

    <input type="text" value="some text"/>

    Result - Resultado

    "some text"
    val(val)

    val(val)

    Set the value of every matched element.

    Ajustar o valor de cada elemento combinado.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • val (String): Set the property to the specified value.
    • val (String): Ajustar a propriedade ao valor especificado.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("input").val("test");

    Before - Antes

    <input type="text" value="some text"/>

    Result - Resultado

    <input type="text" value="test"/>
    Manipulation
    after(content)

    after(content)

    Insert content after each of the matched elements.

    Introduzir o índice após cada um dos elementos combinados.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • content (<Content>): Content to insert after each target.
    • content (<Content>): Índice a introduzir após cada alvo.

    Example - Exemplo

    Inserts some HTML after all paragraphs.

    Introduz algum HTML após todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").after("<b>Hello</b>");

    Before - Antes

    <p>I would like to say: </p>

    Result - Resultado

    <p>I would like to say: </p><b>Hello</b>

    Example - Exemplo

    Inserts an Element after all paragraphs.

    Introduz um elemento após todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").after( $("#foo")[0] );

    Before - Antes

    <b id="foo">Hello</b><p>I would like to say: </p>

    Result - Resultado

    <p>I would like to say: </p><b id="foo">Hello</b>

    Example - Exemplo

    Inserts a jQuery object (similar to an Array of DOM Elements) after all paragraphs.

    Introduz um objeto do jQuery (similar a uma disposição de elementos de DOM) após todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").after( $("b") );

    Before - Antes

    <b>Hello</b><p>I would like to say: </p>

    Result - Resultado

    <p>I would like to say: </p><b>Hello</b>
    append(content)

    append(content)

    Append content to the inside of every matched element.

    This operation is similar to doing an appendChild to all the specified elements, adding them into the document.

    Adicionar o índice ao interior de cada elemento combinado. Esta operação é similar a fazer um appendChild a todos os elementos especificados, adicionando os no original.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • content (<Content>): Content to append to the target
    • content (<Content>): Índice a adicionar ao alvo.

    Example - Exemplo

    Appends some HTML to all paragraphs.

    Adiciona algum HTML a todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").append("<b>Hello</b>");

    Before - Antes

    <p>I would like to say: </p>

    Result - Resultado

    <p>I would like to say: <b>Hello</b></p>

    Example - Exemplo

    Appends an Element to all paragraphs.

    Adiciona um elemento a todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").append( $("#foo")[0] );

    Before - Antes

    <p>I would like to say: </p><b id="foo">Hello</b>

    Result - Resultado

    <p>I would like to say: <b id="foo">Hello</b></p>

    Example - Exemplo

    Appends a jQuery object (similar to an Array of DOM Elements) to all paragraphs.

    Adiciona um objeto do jQuery (similar a uma disposição de elementos de DOM) a todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").append( $("b") );

    Before - Antes

    <p>I would like to say: </p><b>Hello</b>

    Result - Resultado

    <p>I would like to say: <b>Hello</b></p>
    appendTo(content)

    appendTo(content)

    Append all of the matched elements to another, specified, set of elements. This operation is, essentially, the reverse of doing a regular $(A).append(B), in that instead of appending B to A, you're appending A to B.

    Adicionar todos os elementos combinados a outros, especificado, jogo dos elementos. Esta operação é, essencialmente, o reverso de fazer um $ regular (A) .juntar (B), nisso em vez de adicionar B a A, você está adicionando A a B.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • content (<Content>): Content to append to the selected element to.
    • content (<Content>): Índice a adicionar ao elemento selecionado a.

    Example - Exemplo

    Appends all paragraphs to the element with the ID "foo"

    Adiciona todos os parágrafos ao elemento com o ID "foo"

    jQuery Code - código do jQuery

    $("p").appendTo("#foo");

    Before - Antes

    <p>I would like to say: </p><div id="foo"></div>

    Result - Resultado

    <div id="foo"><p>I would like to say: </p></div>
    before(content)

    before(content)

    Insert content before each of the matched elements.

    Introduzir o índice antes de cada um dos elementos combinados.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • content (<Content>): Content to insert before each target.
    • content (<Content>): Índice a introduzir antes de cada alvo.

    Example - Exemplo

    Inserts some HTML before all paragraphs.

    Introduz algum HTML antes de todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").before("<b>Hello</b>");

    Before - Antes

    <p>I would like to say: </p>

    Result - Resultado

    <b>Hello</b><p>I would like to say: </p>

    Example - Exemplo

    Inserts an Element before all paragraphs.

    Introduz um elemento antes de todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").before( $("#foo")[0] );

    Before - Antes

    <p>I would like to say: </p><b id="foo">Hello</b>

    Result - Resultado

    <b id="foo">Hello</b><p>I would like to say: </p>

    Example - Exemplo

    Inserts a jQuery object (similar to an Array of DOM Elements) before all paragraphs.

    Introduz um objeto do jQuery (similar a uma disposição de elementos de DOM) antes de todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").before( $("b") );

    Before - Antes

    <p>I would like to say: </p><b>Hello</b>

    Result - Resultado

    <b>Hello</b><p>I would like to say: </p>
    clone(deep)

    clone(deep)

    Clone matched DOM Elements and select the clones.

    This is useful for moving copies of the elements to another location in the DOM.

    Clone elementos combinados de DOM e selecionar clones. Isto é útil para mover cópias dos elementos para uma outra posição no DOM.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • deep (Boolean): (Optional) Set to false if you don't want to clone all descendant nodes, in addition to the element itself.
    • deep (Boolean): (Opcional) ajustar a falso se você não quiser clone todos os nós do descendente, além ao elemento próprio.

    Example - Exemplo

    Clones all b elements (and selects the clones) and prepends them to all paragraphs.

    Clona todos os elementos de b (e seleciona clones) e os introduz a todos os parágrafos.

    jQuery Code - código do jQuery

    $("b").clone().prependTo("p");

    Before - Antes

    <b>Hello</b><p>, how are you?</p>

    Result - Resultado

    <b>Hello</b><p><b>Hello</b>, how are you?</p>
    empty()

    empty()

    Removes all child nodes from the set of matched elements.

    Remove todos os nós do jogo de elementos combinados.

    Returns - Retornos

    jQuery

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").empty()

    Before - Antes

    <p>Hello, <span>Person</span> <a href="#">and person</a></p>

    Result - Resultado

    [ <p></p> ]
    insertAfter(content)

    insertAfter(content)

    Insert all of the matched elements after another, specified, set of elements. This operation is, essentially, the reverse of doing a regular $(A).after(B), in that instead of inserting B after A, you're inserting A after B.

    Introduzir todos os elementos combinados após outros, especificado, jogo dos elementos. Esta operação é, essencialmente, o reverso de fazer um $ regular (A) .Após(B), nisso em vez de introduzir B após A, você está introduzindo A após o B.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • content (<Content>): Índice para introduzir em seguida o elemento selecionado.
    • content (<Content>): Content to insert the selected element after.

    Example - Exemplo

    Same as $("#foo").after("p")

    jQuery Code - código do jQuery

    $("p").insertAfter("#foo");

    Before - Antes

    <p>I would like to say: </p><div id="foo">Hello</div>

    Result - Resultado

    <div id="foo">Hello</div><p>I would like to say: </p>
    insertBefore(content)

    insertBefore(content)

    Insert all of the matched elements before another, specified, set of elements. This operation is, essentially, the reverse of doing a regular $(A).before(B), in that instead of inserting B before A, you're inserting A before B.

    Introduzir todos os elementos combinados antes de outros, especificado, jogo dos elementos. Esta operação é, essencialmente, o reverso de fazer um $ regular (A) .Após(B), nisso em vez de introduzir B antes de A, você está introduzindo A antes do B.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • content (<Content>): Content to insert the selected element before.
    • content (<Content>): Índice para introduzir antes o elemento selecionado.

    Example - Exemplo

    Same as $("#foo").before("p")

    Mesmos que $ (“#foo”) .before (“p”)

    jQuery Code - código do jQuery

    $("p").insertBefore("#foo");

    Before - Antes

    <div id="foo">Hello</div><p>I would like to say: </p>

    Result - Resultado

    <p>I would like to say: </p><div id="foo">Hello</div>
    prepend(content)

    prepend(content)

    Prepend content to the inside of every matched element.

    This operation is the best way to insert elements inside, at the beginning, of all matched elements.

    Introduz o índice ao interior de cada elemento combinado. Esta operação é a mais melhor maneira introduzir para dentro elementos, no começo, de todos os elementos combinados.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • content (<Content>): Content to prepend to the target.
    • content (<Content>): Índice a introduzir ao alvo.

    Example - Exemplo

    Prepends some HTML to all paragraphs.

    Prepends algum HTML a todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").prepend("<b>Hello</b>");

    Before - Antes

    <p>I would like to say: </p>

    Result - Resultado

    <p><b>Hello</b>I would like to say: </p>

    Example - Exemplo

    Prepends an Element to all paragraphs.

    Prepends um elemento a todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").prepend( $("#foo")[0] );

    Before - Antes

    <p>I would like to say: </p><b id="foo">Hello</b>

    Result - Resultado

    <p><b id="foo">Hello</b>I would like to say: </p>

    Example - Exemplo

    Prepends a jQuery object (similar to an Array of DOM Elements) to all paragraphs.

    Introduz um objeto do jQuery (similar a uma disposição de elementos de DOM) a todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").prepend( $("b") );

    Before - Antes

    <p>I would like to say: </p><b>Hello</b>

    Result - Resultado

    <p><b>Hello</b>I would like to say: </p>
    prependTo(content)

    prependTo(content)

    Prepend all of the matched elements to another, specified, set of elements. This operation is, essentially, the reverse of doing a regular $(A).prepend(B), in that instead of prepending B to A, you're prepending A to B.

    introduz todos os elementos combinados a outros, especificado, jogo dos elementos. Esta operação é, essencialmente, o reverso de fazer um $ regular (A) .introduz (B), nisso em vez de introduzir B a A, você introduz A a B.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • content (<Content>): Content to prepend to the selected element to.
    • content (<Content>): Índice a introduzir ao elemento selecionado a.

    Example - Exemplo

    Prepends all paragraphs to the element with the ID "foo"

    Prepends todos os parágrafos ao elemento com o ID “foo”

    jQuery Code - código do jQuery

    $("p").prependTo("#foo");

    Before - Antes

    <p>I would like to say: </p><div id="foo"><b>Hello</b></div>

    Result - Resultado

    <div id="foo"><p>I would like to say: </p><b>Hello</b></div>
    remove(expr)

    remove(expr)

    Removes all matched elements from the DOM. This does NOT remove them from the jQuery object, allowing you to use the matched elements further. Can be filtered with an optional expressions.

    Remove todos os elementos combinados do DOM. Isto não os remove do objeto do jQuery, permitindo que você use os elementos combinados mais. Podem ser filtradas com as expressões opcionais.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • expr (String): (optional) A jQuery expression to filter elements by.
    • expr (String): (opcional) expressão do jQuery de A aos elementos de filtro perto.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").remove();

    Before - Antes

    <p>Hello</p> how are <p>you?</p>

    Result - Resultado

    how are

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").remove(".hello");

    Before - Antes

    <p class="hello">Hello</p> how are <p>you?</p>

    Result - Resultado

    how are <p>you?</p>
    wrap(html)

    wrap(html)

    Wrap all matched elements with a structure of other elements. This wrapping process is most useful for injecting additional stucture into a document, without ruining the original semantic qualities of a document.

    This works by going through the first element provided (which is generated, on the fly, from the provided HTML) and finds the deepest ancestor element within its structure - it is that element that will en-wrap everything else.

    This does not work with elements that contain text. Any necessary text must be added after the wrapping is done.

    Envolve todos os elementos combinados com uma estrutura de outros elementos. Este processo é o mais útil para injetar o elemento adicional em um original, sem arruinar as qualidades semânticas de um original. Isto trabalha atravessando o primeiro elemento fornecido (que é gerado, sobre o HTML fornecido) e achados o elemento o mais profundo do antepassado dentro de sua estrutura - é esse elemento que envolve tudo mais. Isto não trabalha com elementos que contêm o texto. Todo o texto necessário deve ser adicionado depois que envolver é feito.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • html (String): A string of HTML, that will be created on the fly and wrapped around the target.
    • html (String): Uma corda de HTML, será criada, e envolve em torno do alvo.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").wrap("<div class='wrap'></div>");

    Before - Antes

    <p>Test Paragraph.</p>

    Result - Resultado

    <div class='wrap'><p>Test Paragraph.</p></div>
    wrap(elem)

    wrap(elem)

    Wrap all matched elements with a structure of other elements. This wrapping process is most useful for injecting additional stucture into a document, without ruining the original semantic qualities of a document.

    This works by going through the first element provided and finding the deepest ancestor element within its structure - it is that element that will en-wrap everything else.

    This does not work with elements that contain text. Any necessary text must be added after the wrapping is done.

    Envolver todos os elementos combinados com uma estrutura de outros elementos. Este processo é o mais útil para injetar o elemento adicional em um original, sem arruinar as qualidades semânticas de um original. Isto trabalha atravessando o primeiro elemento fornecido e encontrando o elemento o mais profundo do antepassado dentro de sua estrutura - é esse elemento que envolve tudo mais. Isto não trabalha com elementos que contêm o texto. Todo o texto necessário deve ser adicionado depois que envolver é feito.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • elem (Element): A DOM element that will be wrapped around the target.
    • elem (Element): Um elemento de DOM que seja envolvido em torno do alvo.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").wrap( document.getElementById('content') );

    Before - Antes

    <p>Test Paragraph.</p><div id="content"></div>

    Result - Resultado

    <div id="content"><p>Test Paragraph.</p></div>
    Traversing
    add(expr)

    add(expr)

    Adds more elements, matched by the given expression, to the set of matched elements.

    Adiciona mais elementos, combinados pela expressão dada, ao jogo de elementos combinados.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • expr (String): An expression whose matched elements are added
    • expr (String): Uma expressão o cujo combine elementos é adicionada.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").add("span")

    Before - Antes

    <p>Hello</p><span>Hello Again</span>

    Result - Resultado

    [ <p>Hello</p>, <span>Hello Again</span> ]
    add(html)

    add(html)

    Adds more elements, created on the fly, to the set of matched elements.

    Adiciona mais elementos, criados ao jogo de elementos combinados.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • html (String): A string of HTML to create on the fly.
    • html (String): Uma corda do HTML para criar.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").add("<span>Again</span>")

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    [ <p>Hello</p>, <span>Again</span> ]
    add(elements)

    add(elements)

    Adds one or more Elements to the set of matched elements.

    Adiciona um ou mais elemento ao jogo de elementos combinados.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • elements (Element|Array<Element>): One or more Elements to add
    • elements (Element|Array<Element>): Um ou mais elemento a adicionar.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").add( document.getElementById("a") )

    Before - Antes

    <p>Hello</p><p><span id="a">Hello Again</span></p>

    Result - Resultado

    [ <p>Hello</p>, <span id="a">Hello Again</span> ]

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").add( document.forms[0].elements )

    Before - Antes

    <p>Hello</p><p><form><input/><button/></form>

    Result - Resultado

    [ <p>Hello</p>, <input/>, <button/> ]
    children(expr)

    children(expr)

    Get a set of elements containing all of the unique children of each of the matched set of elements.

    Can be filtered with an optional expressions.

    Começar um jogo dos elementos que contêm todas as crianças originais de cada um do jogo combinado dos elementos. Podem ser filtradas com as expressões opcionais.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • expr (String): (optional) An expression to filter the child Elements with
    • expr (String): (opcional) uma expressão para filtrar os elementos da criança.

    Example - Exemplo

    Find all children of each div.

    Encontrar todas as crianças de cada div.

    jQuery Code - código do jQuery

    $("div").children()

    Before - Antes

    <p>Hello</p><div><span>Hello Again</span></div><p>And Again</p>

    Result - Resultado

    [ <span>Hello Again</span> ]

    Example - Exemplo

    Find all children with a class "selected" of each div.

    Encontrar todas as crianças com uma classe “selecionada” de cada div.

    jQuery Code - código do jQuery

    $("div").children(".selected")

    Before - Antes

    <div><span>Hello</span><p class="selected">Hello Again</p><p>And Again</p></div>

    Result - Resultado

    [ <p class="selected">Hello Again</p> ]
    contains(str)

    contains(str)

    Filter the set of elements to those that contain the specified text.

    Filtrar o jogo dos elementos àqueles que contêm o texto especificado.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • str (String): The string that will be contained within the text of an element.
    • str (String): A corda que será contida dentro do texto de um elemento.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").contains("test")

    Before - Antes

    <p>This is just a test.</p><p>So is this</p>

    Result - Resultado

    [ <p>This is just a test.</p> ]
    end()

    end()

    End the most recent 'destructive' operation, reverting the list of matched elements back to its previous state. After an end operation, the list of matched elements will revert to the last state of matched elements.

    If there was no destructive operation before, an empty set is returned.

    Terminar a operação “destrutiva” a mais recente, revertendo a lista de elementos combinados para trás a seu estado precedente. Após uma operação do fim, a lista de elementos combinados reverte ao último estado de elementos combinados. Se não houver nenhuma operação destrutiva antes, um jogo vazio é retornado.

    Returns - Retornos

    jQuery

    Example - Exemplo

    Selects all paragraphs, finds span elements inside these, and reverts the selection back to the paragraphs.

    Seleciona todos os parágrafos, encontra elementos da extensão dentro destes, e reverte a seleção para trás aos parágrafos.

    jQuery Code - código do jQuery

    $("p").find("span").end();

    Before - Antes

    <p><span>Hello</span>, how are you?</p>

    Result - Resultado

    [ <p>...</p> ]
    filter(expression)

    filter(expression)

    Removes all elements from the set of matched elements that do not match the specified expression(s). This method is used to narrow down the results of a search.

    Provide a comma-separated list of expressions to apply multiple filters at once.

    Remove todos os elementos do jogo dos elementos combinados que não combinam as expressões especificadas. Este método é usado estreitar-se abaixo os resultados de uma busca. Fornecer uma lista vírgula-separada das expressões para aplicar filtros múltiplos em uma vez.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • expression (String): Expression(s) to search with.
    • expression (String): Expressões a procurar.

    Example - Exemplo

    Selects all paragraphs and removes those without a class "selected".

    Seleciona todos os parágrafos e remove aqueles sem uma classe “selecionada”.

    jQuery Code - código do jQuery

    $("p").filter(".selected")

    Before - Antes

    <p class="selected">Hello</p><p>How are you?</p>

    Result - Resultado

    [ <p class="selected">Hello</p> ]

    Example - Exemplo

    Selects all paragraphs and removes those without class "selected" and being the first one.

    Seleciona todos os parágrafos e remove aqueles sem a classe “selecionada” e que é primeira.

    jQuery Code - código do jQuery

    $("p").filter(".selected, :first")

    Before - Antes

    <p>Hello</p><p>Hello Again</p><p class="selected">And Again</p>

    Result - Resultado

    [ <p>Hello</p>, <p class="selected">And Again</p> ]
    filter(filter)

    filter(filter)

    Removes all elements from the set of matched elements that do not pass the specified filter. This method is used to narrow down the results of a search.

    Remove todos os elementos do jogo dos elementos combinados que não passam o filtro especificado. Este método é usado estreitar-se abaixo os resultados de uma busca.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • filter (Function): A function to use for filtering
    • filter (Function): Uma função a usar-se para filtrar.

    Example - Exemplo

    Remove all elements that have a child ol element

    Remover todos os elementos que têm um elemento do ol da criança

    jQuery Code - código do jQuery

    $("p").filter(function(index) {
    return $("ol", this).length == 0;
    })

    Before - Antes

    <p><ol><li>Hello</li></ol></p><p>How are you?</p>

    Result - Resultado

    [ <p>How are you?</p> ]
    find(expr)

    find(expr)

    Searches for all elements that match the specified expression. This method is a good way to find additional descendant elements with which to process.

    All searching is done using a jQuery expression. The expression can be written using CSS 1-3 Selector syntax, or basic XPath.

    Procura por todos os elementos que combinam a expressão especificada. Este método é uma maneira boa encontrar os elementos adicionais do descendente com que ao processo. Toda a procura é feita usando uma expressão do jQuery. A expressão pode ser escrita usando a sintaxe do seletor do CSS 1-3, ou XPath básico.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • expr (String): An expression to search with.
    • expr (String): Uma expressão a procurar.

    Example - Exemplo

    Starts with all paragraphs and searches for descendant span elements, same as $("p span")

    Os começos com todos os parágrafos e as buscas para o descendente medem os elementos, mesmos que $ (de “a extensão p”)

    jQuery Code - código do jQuery

    $("p").find("span");

    Before - Antes

    <p><span>Hello</span>, how are you?</p>

    Result - Resultado

    [ <span>Hello</span> ]
    is(expr)

    is(expr)

    Checks the current selection against an expression and returns true, if at least one element of the selection fits the given expression.

    Does return false, if no element fits or the expression is not valid.

    filter(String) is used internally, therefore all rules that apply there apply here, too.

    Verifica a seleção atual de encontro a uma expressão e retorna verdadeiro, se pelo menos um elemento da seleção couber a expressão dada. Retorna falso, se nenhum ajuste do elemento ou a expressão forem inválido. o filtro (corda) é usado internamente, conseqüentemente todas as réguas que se aplicam lá aplica-se aqui, demasiado.

    Returns - Retornos

    Boolean

    Parameters - Parâmetros

    • expr (String): The expression with which to filter
    • expr (String): A expressão referente ao filtro.

    Example - Exemplo

    Returns true, because the parent of the input is a form element

    Retorna verdadeiro, porque o pai da entrada é um elemento do formulário.

    jQuery Code - código do jQuery

    $("input[@type='checkbox']").parent().is("form")

    Before - Antes

    <form><input type="checkbox" /></form>

    Result - Resultado

    true

    Example - Exemplo

    Returns false, because the parent of the input is a p element

    Retorna falso, porque o pai da entrada é um elemento de p.

    jQuery Code - código do jQuery

    $("input[@type='checkbox']").parent().is("form")

    Before - Antes

    <form><p><input type="checkbox" /></p></form>

    Result - Resultado

    false
    next(expr)

    next(expr)

    Get a set of elements containing the unique next siblings of each of the matched set of elements.

    It only returns the very next sibling, not all next siblings.

    Can be filtered with an optional expressions.

    Começar um jogo dos elementos que contêm as irmãs originais de cada um do jogo combinado dos elementos. Retorna somente a irmã seguinte, não todas as irmãs seguintes. Podem ser filtradas com as expressões opcionais.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • expr (String): (optional) An expression to filter the next Elements with
    • expr (String): (opcional) uma expressão para filtrar os elementos seguintes.

    Example - Exemplo

    Find the very next sibling of each paragraph.

    Encontrar a irmã seguinte de cada parágrafo.

    jQuery Code - código do jQuery

    $("p").next()

    Before - Antes

    <p>Hello</p><p>Hello Again</p><div><span>And Again</span></div>

    Result - Resultado

    [ <p>Hello Again</p>, <div><span>And Again</span></div> ]

    Example - Exemplo

    Find the very next sibling of each paragraph that has a class "selected".

    Encontrar a irmã seguinte de cada parágrafo que tem uma classe “selecionada”.

    jQuery Code - código do jQuery

    $("p").next(".selected")

    Before - Antes

    <p>Hello</p><p class="selected">Hello Again</p><div><span>And Again</span></div>

    Result - Resultado

    [ <p class="selected">Hello Again</p> ]
    not(el)

    not(el)

    Removes the specified Element from the set of matched elements. This method is used to remove a single Element from a jQuery object.

    Remove o elemento especificado do jogo de elementos combinados. Este método é usado remover um único elemento de um objeto do jQuery.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • el (Element): An element to remove from the set
    • el (Element): Um elemento a remover do jogo.

    Example - Exemplo

    Removes the element with the ID "selected" from the set of all paragraphs.

    Remove o elemento com o ID “selecionado” do jogo de todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").not( $("#selected")[0] )

    Before - Antes

    <p>Hello</p><p id="selected">Hello Again</p>

    Result - Resultado

    [ <p>Hello</p> ]
    not(expr)

    not(expr)

    Removes elements matching the specified expression from the set of matched elements. This method is used to remove one or more elements from a jQuery object.

    Remove os elementos que combinam a expressão especificada do jogo de elementos combinados. Este método é usado remover um ou mais elemento de um jQuery objeta.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • expr (String): An expression with which to remove matching elements
    • expr (String): Uma expressão para remover os elementos combinando.

    Example - Exemplo

    Removes the element with the ID "selected" from the set of all paragraphs.

    Remove o elemento com o ID “selecionado” do jogo de todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").not("#selected")

    Before - Antes

    <p>Hello</p><p id="selected">Hello Again</p>

    Result - Resultado

    [ <p>Hello</p> ]
    not(elems)

    not(elems)

    Removes any elements inside the array of elements from the set of matched elements. This method is used to remove one or more elements from a jQuery object.

    Remove todos os elementos dentro da disposição dos elementos do jogo de elementos combinados. Este método é usado remover um ou mais elemento de um jQuery objeta.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • elems (jQuery): A set of elements to remove from the jQuery set of matched elements.
    • elems (jQuery): Um jogo dos elementos a remover do jogo do jQuery de elementos combinados.

    Example - Exemplo

    Removes all elements that match "div p.selected" from the total set of all paragraphs.

    Remove todos os elementos que combinam “div p.selected” do jogo total de todos os parágrafos.

    jQuery Code - código do jQuery

    $("p").not( $("div p.selected") )

    Before - Antes

    <div><p>Hello</p><p class="selected">Hello Again</p></div>

    Result - Resultado

    [ <p>Hello</p> ]
    parent(expr)

    parent(expr)

    Get a set of elements containing the unique parents of the matched set of elements.

    Can be filtered with an optional expressions.

    Começar um jogo dos elementos que contêm os pais originais do jogo combinado dos elementos. Podem ser filtradas com as expressões opcionais.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • expr (String): (optional) An expression to filter the parents with
    • expr (String): (opcional) uma expressão para filtrar os pais com.

    Example - Exemplo

    Find the parent element of each paragraph.

    Encontrar o elemento do pai de cada parágrafo.

    jQuery Code - código do jQuery

    $("p").parent()

    Before - Antes

    <div><p>Hello</p><p>Hello</p></div>

    Result - Resultado

    [ <div><p>Hello</p><p>Hello</p></div> ]

    Example - Exemplo

    Find the parent element of each paragraph with a class "selected".

    Encontrar o elemento do pai de cada parágrafo com uma classe “selecionada”.

    jQuery Code - código do jQuery

    $("p").parent(".selected")

    Before - Antes

    <div><p>Hello</p></div><div class="selected"><p>Hello Again</p></div>

    Result - Resultado

    [ <div class="selected"><p>Hello Again</p></div> ]
    parents(expr)

    parents(expr)

    Get a set of elements containing the unique ancestors of the matched set of elements (except for the root element).

    Can be filtered with an optional expressions.

    Começar um jogo dos elementos que contêm os antecessores originais do jogo combinado dos elementos (à exceção do elemento da raiz). Podem ser filtradas com as expressões opcionais.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • expr (String): (optional) An expression to filter the ancestors with
    • expr (String): (opcional) uma expressão para filtrar os antecessores.

    Example - Exemplo

    Find all parent elements of each span.

    Encontrar todos os elementos do pai de cada extensão.

    jQuery Code - código do jQuery

    $("span").parents()

    Before - Antes

    <html><body><div><p><span>Hello</span></p><span>Hello Again</span></div></body></html>

    Result - Resultado

    [ <body>...</body>, <div>...</div>, <p><span>Hello</span></p> ]

    Example - Exemplo

    Find all parent elements of each span that is a paragraph.

    Encontrar todos os elementos do pai de cada extensão que é um parágrafo.

    jQuery Code - código do jQuery

    $("span").parents("p")

    Before - Antes

    <html><body><div><p><span>Hello</span></p><span>Hello Again</span></div></body></html>

    Result - Resultado

    [ <p><span>Hello</span></p> ]
    prev(expr)

    prev(expr)

    Get a set of elements containing the unique previous siblings of each of the matched set of elements.

    Can be filtered with an optional expressions.

    It only returns the immediately previous sibling, not all previous siblings.

    Começar um jogo dos elementos que contêm as irmãs precedentes originais de cada um do jogo combinado dos elementos. Podem ser filtradas com as expressões opcionais. Retorna somente a irmã imediatamente precedente, não todas as irmãs precedentes.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • expr (String): (optional) An expression to filter the previous Elements with
    • expr (String): (opcional) uma expressão para filtrar os elementos precedentes.

    Example - Exemplo

    Find the very previous sibling of each paragraph.

    Encontrar o sibling muito precedente de cada parágrafo.

    jQuery Code - código do jQuery

    $("p").prev()

    Before - Antes

    <p>Hello</p><div><span>Hello Again</span></div><p>And Again</p>

    Result - Resultado

    [ <div><span>Hello Again</span></div> ]

    Example - Exemplo

    Find the very previous sibling of each paragraph that has a class "selected".

    Encontrar a irmã precedente de cada parágrafo que tem uma classe “selecionada”.

    jQuery Code - código do jQuery

    $("p").prev(".selected")

    Before - Antes

    <div><span>Hello</span></div><p class="selected">Hello Again</p><p>And Again</p>

    Result - Resultado

    [ <div><span>Hello</span></div> ]
    siblings(expr)

    siblings(expr)

    Get a set of elements containing all of the unique siblings of each of the matched set of elements.

    Can be filtered with an optional expressions.

    Começar um jogo dos elementos que contêm todos as irmãs originais de cada um do jogo combinado dos elementos. Podem ser filtradas com as expressões opcionais.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • expr (String): (optional) An expression to filter the sibling Elements with
    • expr (String): (opcional) uma expressão para filtrar os elementos da irmã.

    Example - Exemplo

    Find all siblings of each div.

    Encontrar todos os siblings de cada div.

    jQuery Code - código do jQuery

    $("div").siblings()

    Before - Antes

    <p>Hello</p><div><span>Hello Again</span></div><p>And Again</p>

    Result - Resultado

    [ <p>Hello</p>, <p>And Again</p> ]

    Example - Exemplo

    Find all siblings with a class "selected" of each div.

    Encontrar todos os siblings com uma classe “selecionada” de cada div.

    jQuery Code - código do jQuery

    $("div").siblings(".selected")

    Before - Antes

    <div><span>Hello</span></div><p class="selected">Hello Again</p><p>And Again</p>

    Result - Resultado

    [ <p class="selected">Hello Again</p> ]
    CSS
    css(name)

    css(name)

    Access a style property on the first matched element. This method makes it easy to retrieve a style property value from the first matched element.

    Alcança uma propriedade do estilo no primeiro elemento combinado. Este método facilmente recupera um valor da propriedade do estilo do primeiro elemento combinado.

    Returns - Retornos

    String

    Parameters - Parâmetros

    • name (String): The name of the property to access.
    • name (String): O nome da propriedade para acesso.

    Example - Exemplo

    Retrieves the color style of the first paragraph

    Recupera o estilo da cor do primeiro parágrafo.

    jQuery Code - código do jQuery

    $("p").css("color");

    Before - Antes

    <p style="color:red;">Test Paragraph.</p>

    Result - Resultado

    "red"

    Example - Exemplo

    Retrieves the font-weight style of the first paragraph.

    Recupera o font-weight estilo do primeiro parágrafo.

    jQuery Code - código do jQuery

    $("p").css("font-weight");

    Before - Antes

    <p style="font-weight: bold;">Test Paragraph.</p>

    Result - Resultado

    "bold"
    css(properties)

    css(properties)

    Set a key/value object as style properties to all matched elements.

    Ajustar um objeto da chave/valor como propriedades do estilo a todos os elementos combinados.

    This serves as the best way to set a large number of style properties

    Isto serve como a melhor maneira para ajustar um grande número propriedades do estilo em todos os elementos combinados.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • properties (Map): Key/value pairs to set as style properties.
    • properties (Map): chave/valor agrupasse para ajustar-se como propriedades do estilo.

    Example - Exemplo

    Sets color and background styles to all p elements.

    Ajusta estilos da cor e do fundo a todos os elementos de p.

    jQuery Code - código do jQuery

    $("p").css({ color: "red", background: "blue" });

    Before - Antes

    <p>Test Paragraph.</p>

    Result - Resultado

    <p style="color:red; background:blue;">Test Paragraph.</p>
    css(key, value)

    css(key, value)

    Set a single style property to a value, on all matched elements. If a number is provided, it is automatically converted into a pixel value.

    Ajustar uma única propriedade do estilo a um valor, em todos os elementos combinados.Se um número for fornecido, será convertido automaticamente em um valor de pixel.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • key (String): The name of the property to set.
    • key (String): O nome da propriedade a ajustar-se.
    • value (String|Number): The value to set the property to.
    • value (String|Number): O valor para ajustar a propriedade.

    Example - Exemplo

    Changes the color of all paragraphs to red

    Muda a cor de todos os parágrafos para vermelho

    jQuery Code - código do jQuery

    $("p").css("color","red");

    Before - Antes

    <p>Test Paragraph.</p>

    Result - Resultado

    <p style="color:red;">Test Paragraph.</p>

    Example - Exemplo

    Changes the left of all paragraphs to "30px"

    Muda a esquerda de todos os parágrafos a “30px”.

    jQuery Code - código do jQuery

    $("p").css("left",30);

    Before - Antes

    <p>Test Paragraph.</p>

    Result - Resultado

    <p style="left:30px;">Test Paragraph.</p>
    height()

    height()

    Get the current computed, pixel, height of the first matched element.

    Captura altura atual, pixel, altura do primeiro elemento combinado.

    Returns - Retornos

    String

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").height();

    Before - Antes

    <p>This is just a test.</p>

    Result - Resultado

    300
    height(val)

    height(val)

    Set the CSS width of every matched element. If no explicit unit was specified (like 'em' or '%') then "px" is added to the width.

    Ajustar a largura do CSS de cada elemento combinado. Se nenhuma unidade explícita for especificada (like 'em' or '%') então o “px” é adicionado à largura.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • val (String|Number): Set the CSS property to the specified value.
    • val (String|Number): Ajusta a propriedade do CSS ao valor especificado.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").height(20);

    Before - Antes

    <p>This is just a test.</p>

    Result - Resultado

    <p style="height:20px;">This is just a test.</p>

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").height("20em");

    Before - Antes

    <p>This is just a test.</p>

    Result - Resultado

    <p style="height:20em;">This is just a test.</p>
    width()

    width()

    Get the current computed, pixel, width of the first matched element.

    Captura a largura atual, pixel, largura do primeiro elemento combinado.

    Returns - Retornos

    String

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").width();

    Before - Antes

    <p>This is just a test.</p>

    Result - Resultado

    300
    width(val)

    width(val)

    Set the CSS width of every matched element. If no explicit unit was specified (like 'em' or '%') then "px" is added to the width.

    Ajustar a largura do CSS de cada elemento combinado. Se nenhuma unidade explícita for especificada (like 'em' or '%') então o “px” é adicionado à largura.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • val (String|Number): Set the CSS property to the specified value.
    • val (String|Number): Ajusta a propriedade do CSS ao valor especificado.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").width(20);

    Before - Antes

    <p>This is just a test.</p>

    Result - Resultado

    <p style="width:20px;">This is just a test.</p>

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").width("20em");

    Before - Antes

    <p>This is just a test.</p>

    Result - Resultado

    <p style="width:20em;">This is just a test.</p>
    JavaScript
    $.browser

    $.browser

    Contains flags for the useragent, read from navigator.userAgent. Available flags are: safari, opera, msie, mozilla

    This property is available before the DOM is ready, therefore you can use it to add ready events only for certain browsers.

    There are situations where object detections is not reliable enough, in that cases it makes sense to use browser detection. Simply try to avoid both!

    A combination of browser and object detection yields quite reliable results.

    Returns - Retornos

    Boolean

    Example - Exemplo

    Returns true if the current useragent is some version of microsoft's internet explorer

    jQuery Code - código do jQuery

    $.browser.msie

    Example - Exemplo

    Alerts "this is safari!" only for safari browsers

    jQuery Code - código do jQuery

    if($.browser.safari) { $( function() { alert("this is safari!"); } ); }
    $.each(obj, fn)

    $.each(obj, fn)

    A generic iterator function, which can be used to seemlessly iterate over both objects and arrays. This function is not the same as $().each() - which is used to iterate, exclusively, over a jQuery object. This function can be used to iterate over anything.

    The callback has two arguments:the key (objects) or index (arrays) as first the first, and the value as the second.

    Returns - Retornos

    Object

    Parameters - Parâmetros

    • obj (Object): The object, or array, to iterate over.
    • fn (Function): The function that will be executed on every object.

    Example - Exemplo

    This is an example of iterating over the items in an array, accessing both the current item and its index.

    jQuery Code - código do jQuery

    $.each( [0,1,2], function(i, n){
    alert( "Item #" + i + ": " + n );
    });

    Example - Exemplo

    This is an example of iterating over the properties in an Object, accessing both the current item and its key.

    jQuery Code - código do jQuery

    $.each( { name: "John", lang: "JS" }, function(i, n){
    alert( "Name: " + i + ", Value: " + n );
    });
    $.extend(target, prop1, propN)

    $.extend(target, prop1, propN)

    Extend one object with one or more others, returning the original, modified, object. This is a great utility for simple inheritance.

    Returns - Retornos

    Object

    Parameters - Parâmetros

    • target (Object): The object to extend
    • prop1 (Object): The object that will be merged into the first.
    • propN (Object): (optional) More objects to merge into the first

    Example - Exemplo

    Merge settings and options, modifying settings

    jQuery Code - código do jQuery

    var settings = { validate: false, limit: 5, name: "foo" };
    var options = { validate: true, name: "bar" };
    jQuery.extend(settings, options);

    Result - Resultado

    settings == { validate: true, limit: 5, name: "bar" }

    Example - Exemplo

    Merge defaults and options, without modifying the defaults

    jQuery Code - código do jQuery

    var defaults = { validate: false, limit: 5, name: "foo" };
    var options = { validate: true, name: "bar" };
    var settings = jQuery.extend({}, defaults, options);

    Result - Resultado

    settings == { validate: true, limit: 5, name: "bar" }
    $.grep(array, fn, inv)

    $.grep(array, fn, inv)

    Filter items out of an array, by using a filter function.

    The specified function will be passed two arguments: The current array item and the index of the item in the array. The function must return 'true' to keep the item in the array, false to remove it.

    Returns - Retornos

    Array

    Parameters - Parâmetros

    • array (Array): The Array to find items in.
    • fn (Function): The function to process each item against.
    • inv (Boolean): Invert the selection - select the opposite of the function.

    Example - Exemplo

    jQuery Code - código do jQuery

    $.grep( [0,1,2], function(i){
    return i > 0;
    });

    Result - Resultado

    [1, 2]
    $.map(array, fn)

    $.map(array, fn)

    Translate all items in an array to another array of items.

    The translation function that is provided to this method is called for each item in the array and is passed one argument: The item to be translated.

    The function can then return the translated value, 'null' (to remove the item), or an array of values - which will be flattened into the full array.

    Returns - Retornos

    Array

    Parameters - Parâmetros

    • array (Array): The Array to translate.
    • fn (Function): The function to process each item against.

    Example - Exemplo

    Maps the original array to a new one and adds 4 to each value.

    jQuery Code - código do jQuery

    $.map( [0,1,2], function(i){
    return i + 4;
    });

    Result - Resultado

    [4, 5, 6]

    Example - Exemplo

    Maps the original array to a new one and adds 1 to each value if it is bigger then zero, otherwise it's removed-

    jQuery Code - código do jQuery

    $.map( [0,1,2], function(i){
    return i > 0 ? i + 1 : null;
    });

    Result - Resultado

    [2, 3]

    Example - Exemplo

    Maps the original array to a new one, each element is added with it's original value and the value plus one.

    jQuery Code - código do jQuery

    $.map( [0,1,2], function(i){
    return [ i, i + 1 ];
    });

    Result - Resultado

    [0, 1, 1, 2, 2, 3]
    $.merge(first, second)

    $.merge(first, second)

    Merge two arrays together, removing all duplicates.

    The result is the altered first argument with the unique elements from the second array added.

    Returns - Retornos

    Array

    Parameters - Parâmetros

    • first (Array): The first array to merge, the unique elements of second added.
    • second (Array): The second array to merge into the first, unaltered.

    Example - Exemplo

    Merges two arrays, removing the duplicate 2

    jQuery Code - código do jQuery

    $.merge( [0,1,2], [2,3,4] )

    Result - Resultado

    [0,1,2,3,4]

    Example - Exemplo

    Merges two arrays, removing the duplicates 3 and 2

    jQuery Code - código do jQuery

    var array = [3,2,1];
    $.merge( array, [4,3,2] )

    Result - Resultado

    array == [3,2,1,4]
    $.trim(str)

    $.trim(str)

    Remove the whitespace from the beginning and end of a string.

    Returns - Retornos

    String

    Parameters - Parâmetros

    • str (String): The string to trim.

    Example - Exemplo

    jQuery Code - código do jQuery

    $.trim("  hello, how are you?  ");

    Result - Resultado

    "hello, how are you?"
    Events
    bind(type, data, fn)

    bind(type, data, fn)

    Binds a handler to a particular event (like click) for each matched element. The event handler is passed an event object that you can use to prevent default behaviour. To stop both default action and event bubbling, your handler has to return false.

    In most cases, you can define your event handlers as anonymous functions (see first example). In cases where that is not possible, you can pass additional data as the second paramter (and the handler function as the third), see second example.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • type (String): An event type
    • data (Object): (optional) Additional data passed to the event handler as event.data
    • fn (Function): A function to bind to the event on each of the set of matched elements

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").bind("click", function(){
    alert( $(this).text() );
    });

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    alert("Hello")

    Example - Exemplo

    Pass some additional data to the event handler.

    jQuery Code - código do jQuery

    function handler(event) {
    alert(event.data.foo);
    }
    $("p").bind("click", {foo: "bar"}, handler)

    Result - Resultado

    alert("bar")

    Example - Exemplo

    Cancel a default action and prevent it from bubbling by returning false from your function.

    jQuery Code - código do jQuery

    $("form").bind("submit", function() { return false; })

    Example - Exemplo

    Cancel only the default action by using the preventDefault method.

    jQuery Code - código do jQuery

    $("form").bind("submit", function(event){
    event.preventDefault();
    });

    Example - Exemplo

    Stop only an event from bubbling by using the stopPropagation method.

    jQuery Code - código do jQuery

    $("form").bind("submit", function(event){
    event.stopPropagation();
    });
    blur()

    blur()

    Trigger the blur event of each matched element. This causes all of the functions that have been bound to thet blur event to be executed.

    Note: This does not execute the blur method of the underlying elements! If you need to blur an element via code, you have to use the DOM method, eg. $("#myinput")[0].blur();

    Returns - Retornos

    jQuery

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").blur();

    Before - Antes

    <p onblur="alert('Hello');">Hello</p>

    Result - Resultado

    alert('Hello');
    blur(fn)

    blur(fn)

    Bind a function to the blur event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the blur event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").blur( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onblur="alert('Hello');">Hello</p>
    change(fn)

    change(fn)

    Bind a function to the change event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the change event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").change( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onchange="alert('Hello');">Hello</p>
    click()

    click()

    Trigger the click event of each matched element. This causes all of the functions that have been bound to thet click event to be executed.

    Returns - Retornos

    jQuery

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").click();

    Before - Antes

    <p onclick="alert('Hello');">Hello</p>

    Result - Resultado

    alert('Hello');
    click(fn)

    click(fn)

    Bind a function to the click event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the click event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").click( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onclick="alert('Hello');">Hello</p>
    dblclick(fn)

    dblclick(fn)

    Bind a function to the dblclick event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the dblclick event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").dblclick( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p ondblclick="alert('Hello');">Hello</p>
    error(fn)

    error(fn)

    Bind a function to the error event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the error event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").error( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onerror="alert('Hello');">Hello</p>
    focus()

    focus()

    Trigger the focus event of each matched element. This causes all of the functions that have been bound to thet focus event to be executed.

    Note: This does not execute the focus method of the underlying elements! If you need to focus an element via code, you have to use the DOM method, eg. $("#myinput")[0].focus();

    Returns - Retornos

    jQuery

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").focus();

    Before - Antes

    <p onfocus="alert('Hello');">Hello</p>

    Result - Resultado

    alert('Hello');
    focus(fn)

    focus(fn)

    Bind a function to the focus event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the focus event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").focus( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onfocus="alert('Hello');">Hello</p>
    hover(over, out)

    hover(over, out)

    A method for simulating hovering (moving the mouse on, and off, an object). This is a custom method which provides an 'in' to a frequent task.

    Whenever the mouse cursor is moved over a matched element, the first specified function is fired. Whenever the mouse moves off of the element, the second specified function fires. Additionally, checks are in place to see if the mouse is still within the specified element itself (for example, an image inside of a div), and if it is, it will continue to 'hover', and not move out (a common error in using a mouseout event handler).

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • over (Function): The function to fire whenever the mouse is moved over a matched element.
    • out (Function): The function to fire whenever the mouse is moved off of a matched element.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").hover(function(){
    $(this).addClass("over");
    },function(){
    $(this).addClass("out");
    });
    keydown(fn)

    keydown(fn)

    Bind a function to the keydown event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the keydown event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").keydown( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onkeydown="alert('Hello');">Hello</p>
    keypress(fn)

    keypress(fn)

    Bind a function to the keypress event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the keypress event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").keypress( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onkeypress="alert('Hello');">Hello</p>
    keyup(fn)

    keyup(fn)

    Bind a function to the keyup event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the keyup event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").keyup( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onkeyup="alert('Hello');">Hello</p>
    load(fn)

    load(fn)

    Bind a function to the load event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the load event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").load( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onload="alert('Hello');">Hello</p>
    mousedown(fn)

    mousedown(fn)

    Bind a function to the mousedown event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the mousedown event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").mousedown( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onmousedown="alert('Hello');">Hello</p>
    mousemove(fn)

    mousemove(fn)

    Bind a function to the mousemove event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the mousemove event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").mousemove( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onmousemove="alert('Hello');">Hello</p>
    mouseout(fn)

    mouseout(fn)

    Bind a function to the mouseout event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the mouseout event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").mouseout( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onmouseout="alert('Hello');">Hello</p>
    mouseover(fn)

    mouseover(fn)

    Bind a function to the mouseover event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the mousedown event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").mouseover( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onmouseover="alert('Hello');">Hello</p>
    mouseup(fn)

    mouseup(fn)

    Bind a function to the mouseup event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the mouseup event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").mouseup( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onmouseup="alert('Hello');">Hello</p>
    one(type, data, fn)

    one(type, data, fn)

    Binds a handler to a particular event (like click) for each matched element. The handler is executed only once for each element. Otherwise, the same rules as described in bind() apply. The event handler is passed an event object that you can use to prevent default behaviour. To stop both default action and event bubbling, your handler has to return false.

    In most cases, you can define your event handlers as anonymous functions (see first example). In cases where that is not possible, you can pass additional data as the second paramter (and the handler function as the third), see second example.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • type (String): An event type
    • data (Object): (optional) Additional data passed to the event handler as event.data
    • fn (Function): A function to bind to the event on each of the set of matched elements

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").one("click", function(){
    alert( $(this).text() );
    });

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    alert("Hello")
    ready(fn)

    ready(fn)

    Bind a function to be executed whenever the DOM is ready to be traversed and manipulated. This is probably the most important function included in the event module, as it can greatly improve the response times of your web applications.

    In a nutshell, this is a solid replacement for using window.onload, and attaching a function to that. By using this method, your bound Function will be called the instant the DOM is ready to be read and manipulated, which is exactly what 99.99% of all Javascript code needs to run.

    There is one argument passed to the ready event handler: A reference to the jQuery function. You can name that argument whatever you like, and can therefore stick with the $ alias without risc of naming collisions.

    Please ensure you have no code in your <body> onload event handler, otherwise $(document).ready() may not fire.

    You can have as many $(document).ready events on your page as you like. The functions are then executed in the order they were added.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): The function to be executed when the DOM is ready.

    Example - Exemplo

    jQuery Code - código do jQuery

    $(document).ready(function(){ Your code here... });

    Example - Exemplo

    Uses both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias.

    jQuery Code - código do jQuery

    jQuery(function($) {
    // Your code using failsafe $ alias here...
    });
    resize(fn)

    resize(fn)

    Bind a function to the resize event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the resize event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").resize( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onresize="alert('Hello');">Hello</p>
    scroll(fn)

    scroll(fn)

    Bind a function to the scroll event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the scroll event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").scroll( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onscroll="alert('Hello');">Hello</p>
    select()

    select()

    Trigger the select event of each matched element. This causes all of the functions that have been bound to thet select event to be executed.

    Returns - Retornos

    jQuery

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").select();

    Before - Antes

    <p onselect="alert('Hello');">Hello</p>

    Result - Resultado

    alert('Hello');
    select(fn)

    select(fn)

    Bind a function to the select event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the select event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").select( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onselect="alert('Hello');">Hello</p>
    submit()

    submit()

    Trigger the submit event of each matched element. This causes all of the functions that have been bound to thet submit event to be executed.

    Note: This does not execute the submit method of the form element! If you need to submit the form via code, you have to use the DOM method, eg. $("form")[0].submit();

    Returns - Retornos

    jQuery

    Example - Exemplo

    Triggers all submit events registered for forms, but does not submit the form

    jQuery Code - código do jQuery

    $("form").submit();
    submit(fn)

    submit(fn)

    Bind a function to the submit event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the submit event on each of the matched elements.

    Example - Exemplo

    Prevents the form submission when the input has no value entered.

    jQuery Code - código do jQuery

    $("#myform").submit( function() {
    return $("input", this).val().length > 0;
    } );

    Before - Antes

    <form id="myform"><input /></form>
    toggle(even, odd)

    toggle(even, odd)

    Toggle between two function calls every other click. Whenever a matched element is clicked, the first specified function is fired, when clicked again, the second is fired. All subsequent clicks continue to rotate through the two functions.

    Use unbind("click") to remove.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • even (Function): The function to execute on every even click.
    • odd (Function): The function to execute on every odd click.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").toggle(function(){
    $(this).addClass("selected");
    },function(){
    $(this).removeClass("selected");
    });
    trigger(type)

    trigger(type)

    Trigger a type of event on every matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • type (String): An event type to trigger.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").trigger("click")

    Before - Antes

    <p click="alert('hello')">Hello</p>

    Result - Resultado

    alert('hello')
    unbind(type, fn)

    unbind(type, fn)

    The opposite of bind, removes a bound event from each of the matched elements.

    Without any arguments, all bound events are removed.

    If the type is provided, all bound events of that type are removed.

    If the function that was passed to bind is provided as the second argument, only that specific event handler is removed.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • type (String): (optional) An event type
    • fn (Function): (optional) A function to unbind from the event on each of the set of matched elements

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").unbind()

    Before - Antes

    <p onclick="alert('Hello');">Hello</p>

    Result - Resultado

    [ <p>Hello</p> ]

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").unbind( "click" )

    Before - Antes

    <p onclick="alert('Hello');">Hello</p>

    Result - Resultado

    [ <p>Hello</p> ]

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").unbind( "click", function() { alert("Hello"); } )

    Before - Antes

    <p onclick="alert('Hello');">Hello</p>

    Result - Resultado

    [ <p>Hello</p> ]
    unload(fn)

    unload(fn)

    Bind a function to the unload event of each matched element.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • fn (Function): A function to bind to the unload event on each of the matched elements.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").unload( function() { alert("Hello"); } );

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    <p onunload="alert('Hello');">Hello</p>
    Effects
    animate(params, speed, easing, callback)

    animate(params, speed, easing, callback)

    A function for making your own, custom, animations. The key aspect of this function is the object of style properties that will be animated, and to what end. Each key within the object represents a style property that will also be animated (for example: "height", "top", or "opacity").

    The value associated with the key represents to what end the property will be animated. If a number is provided as the value, then the style property will be transitioned from its current state to that new number. Oterwise if the string "hide", "show", or "toggle" is provided, a default animation will be constructed for that property.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • params (Hash): A set of style attributes that you wish to animate, and to what end.
    • speed (String|Number): (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
    • easing (String): (optional) The name of the easing effect that you want to use (Plugin Required).
    • callback (Function): (optional) A function to be executed whenever the animation completes.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").animate({
    height: 'toggle', opacity: 'toggle'
    }, "slow");

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").animate({
    left: 50, opacity: 'show'
    }, 500);

    Example - Exemplo

    An example of using an 'easing' function to provide a different style of animation. This will only work if you have a plugin that provides this easing function (Only 'linear' is provided by default, with jQuery).

    jQuery Code - código do jQuery

    $("p").animate({
    opacity: 'show'
    }, "slow", "easein");
    fadeIn(speed, callback)

    fadeIn(speed, callback)

    Fade in all matched elements by adjusting their opacity and firing an optional callback after completion.

    Only the opacity is adjusted for this animation, meaning that all of the matched elements should already have some form of height and width associated with them.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • speed (String|Number): (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
    • callback (Function): (optional) A function to be executed whenever the animation completes.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").fadeIn("slow");

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").fadeIn("slow",function(){
    alert("Animation Done.");
    });
    fadeOut(speed, callback)

    fadeOut(speed, callback)

    Fade out all matched elements by adjusting their opacity and firing an optional callback after completion.

    Only the opacity is adjusted for this animation, meaning that all of the matched elements should already have some form of height and width associated with them.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • speed (String|Number): (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
    • callback (Function): (optional) A function to be executed whenever the animation completes.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").fadeOut("slow");

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").fadeOut("slow",function(){
    alert("Animation Done.");
    });
    fadeTo(speed, opacity, callback)

    fadeTo(speed, opacity, callback)

    Fade the opacity of all matched elements to a specified opacity and firing an optional callback after completion.

    Only the opacity is adjusted for this animation, meaning that all of the matched elements should already have some form of height and width associated with them.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • speed (String|Number): A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
    • opacity (Number): The opacity to fade to (a number from 0 to 1).
    • callback (Function): (optional) A function to be executed whenever the animation completes.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").fadeTo("slow", 0.5);

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").fadeTo("slow", 0.5, function(){
    alert("Animation Done.");
    });
    hide()

    hide()

    Hides each of the set of matched elements if they are shown.

    Returns - Retornos

    jQuery

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").hide()

    Before - Antes

    <p>Hello</p>

    Result - Resultado

    [ <p style="display: none">Hello</p> ]
    hide(speed, callback)

    hide(speed, callback)

    Hide all matched elements using a graceful animation and firing an optional callback after completion.

    The height, width, and opacity of each of the matched elements are changed dynamically according to the specified speed.

    Returns - Retornos

    jQuery

    Parameters - Parâmetros

    • speed (String|Number): A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
    • callback (Function): (optional) A function to be executed whenever the animation completes.

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").hide("slow");

    Example - Exemplo

    jQuery Code - código do jQuery

    $("p").hide("slow",function(){
    alert("Animation Done.");
    });
    show()

    show()

    Displays each of the set of matched elements if they are hidden.