How can I get JSDoc to mark my param as a jQuery object?

Nick G. picture Nick G. · Nov 28, 2012 · Viewed 13.2k times · Source

I'm attempting to thoroughly comment my JavaScript and I'm using JSDoc. I have a function that consumes a jQuery object and I'd like to mark the parameter as such.

Currently, I have this:

/**
 * Initializes a login object.
 * @param formEl {JQuery} The login form element on the page.
 */
var login = function(formEl){ ... }

But JSDoc doesn't recognize (or properly format) "JQuery" as a variable type. Any help?

Answer

OneOfOne picture OneOfOne · Nov 28, 2012

According to http://code.google.com/p/jsdoc-toolkit/wiki/TagParam it should be

Param type before param name.

/**
 * Initializes a login object.
 * @param {jQuery} formEl The login form element on the page.
 */
var login = function(formEl){ ... }