While reading the jQuery documentation about the jQuery object I came upon this line:
Alternatively, because the jQuery object is "array-like," it supports array subscripting via brackets:
// Selecting only the first 'h1' element on the page (alternate approach)
var firstHeaderElem = $("h1")[ 0 ];
I tested this out using three paragraphs with the jQuery like this:
$(document).ready(function() {
var t = $("p")[0];
$("button").click(
function()
{
t.fadeOut();
});
});
It doesn't work. Is this because using array notation doesn't really return a jQuery object, thus the methods are not available?
$(t).fadeOut()?