javascript - Why sometimes jQuery selector returns something like "a.fn.init"? -


i don't know happen chrome browser, of sudden behavior of doing $('div#my') in console totally different before. 1 time i've experienced later somehow recovered, don't know how reproduce it, , today happened again.

please watch video:http://peaceevertvimg.org/jq.php.

in video $('div#my') in 2 different browsers:

the first browser not chrome believe uses chrome's kernel behavior expect, , because chrome not working expected have use demonstrate expection: when $('div#my)` see directly html tag, , can see tag's html content, "something" in case.

in contrast, in chrome browser, result different, when $('div#my') see object(n.fn.init), , can't see "something" immediately, of course inconvenient. before, pretty sure not this, behavior in first browser.

the simple webpage in video http://peaceevertvimg.org/jquery.php, can go test in chrome browser. , pretty sure of won't see result shown in video. happened chrome?(i've disabled expansions , updated latest version)

if open chrome's developer tools console given page , invoke $ should see

$(selector, [startnode]) { [command line api] } 

if same thing on page has jquery loaded, you'll see

function (a,b){return new n.fn.init(a,b)} 

evaluating $($0) going depend on context of page given above information. you'll either element reference or jquery object.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -