I need to write the jQuery ready function and then:
Inside the jQuery ready function, use jQuery to get all of the <h2> elements on the a new Git branch titled “headings” based off the “v0.1” tag with the following: page and assign them to a variable named headings; Without creating any new variables, change the text of the last element of the headings variable to: “I’m firstname lastname, and I’m learning jQuery!” (replace “firstname lastname” with your first and last name).
Here is the jQuery I have, yet keep getting an error:
$(document).ready(function(){
var headings = $('h2');
$('headings').h2(3)
.text ("I'm Arianna Delin, and I'm learning jQuery!");
}).triggerHandler('change');
Can someone tell me what I am doing wrong?
$('headings')is running a query against the DOM using the "headings" selector: it won't find anything. What you mean there is justheadings(the variable). 2) jQuery has noh2function: if you want to retrieve the n-th element have a look at the selectors :nth-child() and :eq() (from what you said I would say to also have a look at :last and :last-child). 3) what is the reason for the triggerHandler?