jQuery is() Metodo
❮ Metodi di attraversamento jQuery
Esempio
Se il genitore di <p> è un elemento <div>, avvisa del testo:
if ($("p").parent().is("div")) {
alert("Parent of p is div");
}
Definizione e utilizzo
Il metodo is() controlla se uno degli elementi selezionati corrisponde a selectorElement .
Sintassi
$(selector).is(selectorElement,function(index,element))
Parameter | Description |
---|---|
selectorElement | Required. Specifies a selector expression, element or a jQuery object to match the current set of elements against. Returns true if there is at least one match from the given argument, and false if not. |
function(index,element) |
Optional. Specifies a function to run for the group of selected elements.
|
❮ Metodi di attraversamento jQuery