Wikipedia:Reference desk/Archives/Computing/2017 February 23

= February 23 =

The Jquery object
browser.window.document.element.console

Above is the traditional Js object chain. Where should the Jquery object be inserted inside this chain? (I would bet, right after document). Ben-Yeudith (talk) 15:17, 23 February 2017 (UTC)
 * Well, unless I'm mistaken, there is no definitive JQuery object. Rather, there's the JQuery function ($) which returns an existing object from the DOM (or from the window, I believe, though I've always accessed the window through CSS). So I don't think there's really a clear answer to this. JQuery itself is an extension of javascript, so it should be at a lower level than the element, because the element contains the code. Also, I'm pretty certain there's no way to go higher than the window with JS or JQuery, so having the browser at the beginning is a little confusing. I could be wrong, however. I'm just a code monkey, not a JS or JQ guru. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  15:46, 23 February 2017 (UTC)
 * It's true that jQuery [sic] is a function (usually aliased to $), but it's also an object (as all functions are in JavaScript), and is a member of  (i.e. it has 'global scope', so you can call it from anywhere in your code without having to qualify it). As well as being a function it also has members, most of which are themselves functions: for example   and its related functions such as   and  . There's perhaps some confusion about the things that are returned by the jQuery function, as in , which are sometimes called 'jQuery objects' or 'jQuery object instances', and are things that you can perform actions on, such as   . (The global jQuery object doesn't have most of these 'action' functions:   is undefined.) AndrewWTaylor (talk) 16:18, 23 February 2017 (UTC)
 * but it's also an object (as all functions are in JavaScript) I didn't consider that, but you're right, of course. So yes, it would sit parallel with the document. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  16:56, 23 February 2017 (UTC)