Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTerri Valentine
23,034 PointsjQuery Basics Challenge Task 1 of 2 JQuery Basics
Challenge Task 1 of 2
Using the on() method, attach an event handler to handle click events on the ul element with the class of .student-list. Be sure to pass in the event object to the callback function.
I am stuck on this objective. What am I missing? Or am I totally wrong with my code?
var student-list ('click',function(event){ console.log(event); })
4 Answers
Heath Burton
12,978 PointsI got stuck on this one as well as I used the , 'ul' in-between the 'click' event and the 'function' call back. This was not necessary as the class points to the ul already I assume.
Working code:
$('.student-list').on('click', function(event){
});
GG
Heath Burton
12,978 PointsI remember that one, the $ is supposed to be there but for some reason it works when you remove it.
If you google the question it has the answer in the forums here already.
GL Terri!
Zach Freitag
20,341 PointsChallenge Task 2 of 2:
$('.student-list').on('click', function(event){
$(event.target).hide()
});
Cheers!
Gertrude Dawson
5,371 PointsThank you all for responding to this question. My google searches turned up nothing useful except on the treehouse forum. Sometimes the information will be on other code learning sites.
Terri Valentine
23,034 PointsTerri Valentine
23,034 PointsThank you, thank you, Heath Burton. I spent 2-3 days working on these jQuery objectives. I thought I was stuck here forever. Lol.
Terri Valentine
23,034 PointsTerri Valentine
23,034 PointsHeath Burton Any help would be appreciated.
Select the submit button by its class and save it to a variable called $submit. Then use the appropriate jQuery method to disable the button by adding a disabled attribute to it.
John Bastian Bolhano
4,800 PointsJohn Bastian Bolhano
4,800 PointsIt took me a while as well I use `` $(".student-list").on("click", (e) => { });
instead of `` $('.student-list').on('click', function(event){ });
lol