jQuery events: using .keydown - different code but still passed?


#1

The grader wanted this code:

$(document).ready(function()
{

    $(document).event(function(key)

But it still passed my code:

$(document).ready(function () {

   
$(document)keydown(function () {

      $(this).key()

    });

});

Is this just a difference of the model answer using shorthand compared to my code using longhand? Or, are these two pieces of code fundamentally different?

Dethcow


#2

The unit is very introductory and not at all exhaustive, so it follows the SCT is going to be minimal, and may not examine edge cases. Clearly neither of the above would have passed a more stringent test.

That is placeholder text, not a actual keyword.

will result in an error since the dot is missing.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.