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 trialAaron Coursolle
18,014 PointsThis should be added to the list of correct answers:
.removeAttr()
The official JQuery doc use dots at the start of their method names, but at the time of writing this response, .removeAttr() (with a dot) doesn't pass.
2 Answers
Graham Tonelli
11,968 PointsYou may want to post the code you're having trouble with! The most simple solution might be to put an element in front of the function, and call the jQuery method with a $.
$("h1").removeAttr()
For example.
I hope this helps! Cheers
Chris Shaw
26,676 PointsHi Aaron Coursolle,
An answer containing the period wouldn't be valid as periods are not a part of method names since they denote a piece of child functionality on the parent object, the correct answer would in this case just be removeAttr()
as removeAttr
is the method.
Hope that helps.
Aaron Coursolle
18,014 PointsBut why wouldn't it be valid if the docs themselves use the dot as part of the name?
"The .removeAttr() method uses the JavaScript removeAttribute() function..."
Chris Shaw
26,676 PointsThe jQuery documentation I assume does that to show that the function is a method of the $
object so it isn't seen as a standalone function. That said; Other sites such as MDN demonstrate methods correctly by name instead of having the period too which is incorrect since as I mentioned periods aren't part of a method name.