jqueryfunctionparametersready

parameter handed from ready() to function


I got this code snippet from an image uploader:

$(document).ready(function (e) {
$("#uploadimage").on('submit',(function(e) {e.preventDefault();}));
});

(I set the last brackets by myself). I am new to jQuery and I am wondering what the "e" stands for? Is "e" a variable handed from ready() to the function?


Solution

  • There are two es in your snippet, and they're different.

    The e passed to the ready callback is a reference to the jQuery/$ function.

    The e passed to the callback on the submit event is an Event object.

    This is all covered by the documentation: ready, on