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 trialSamuel Rueby
22,538 PointsBuild an interactive website challenge 3 - confusing wording.
What is the wording of this challenge trying to say?
"On the next line select the "textarea" call "validEmail" and pass in the parameters of "on" set to "keyup", and "success" and "failure" set to empty anonymous functions."
Call validEmail on the textarea? Pass in the parameter of "on" what? What success and failure functions? You're not able to view the source of validEmail in the challenge.
3 Answers
Ron McCranie
7,837 PointsDon't worry about needing to see the contents of the validEmail.js plugin. You're just going to call the function from the file you're working with.
- Select the text area: $('textarea')
- Call valid Email: $('textarea'),validEmail();
- pass the parameters of "on" set to "keyup": on:'keyup'
- success and failure to empty anonymous functions: success:function(){ }, failure:function(){}
EXAMPLE OF EMPTY anonymous FUNCTION:
// anonymous means there is no name for the function
function() { /*--this part here is empty--*/ };
FINAL CODE:
var isValid = $('input[type="text"]').validEmail();
$('textarea').validEmail({
on:'keyup',
success:function(){ },
failure:function(){}
});
Shawn Flanigan
Courses Plus Student 15,815 Pointson
, success
, and failure
are all parameters for the validEmail
function in the plugin. When calling the validEmail
function, you can optionally pass these parameters (and values for them) into the function as an object. Here's what that will end up looking like for this task:
$("textarea").validEmail({
on: "keyup",
success: function(){},
failure: function(){}
});
Hope this helps!
Thomas Horner
11,185 Points$('textarea').on('keyup', success: function(){
},
failure: function(){
})