Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1020217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:07:57+00:00 2026-05-16T11:07:57+00:00

var username = $(#username), password = $(#password), allFields = $([]).add(username).add(password); What is allFields? What

  • 0
var username = $("#username"),
                password = $("#password"),
                allFields = $([]).add(username).add(password);

What is allFields? What is $([])?

Being a newbie to Javascript/jQuery, I’ve never seen this $([]) notation before and I’m interested in its associated methods.

Given that its “$([])”, it’s tricky to search for. And a Google search of arrays in Javascript (guessing that thing is an array of some sort) yields the typical arrays I’m familiar seeing.

So what is $([])? Can anyone point me to some documentation? I’m interested in learning how to use this strange thing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:07:58+00:00Added an answer on May 16, 2026 at 11:07 am

    The jQuery function accepts an array of DOM nodes.

    $([document.body]) for example which will return a jQuery object by wrapping all the DOM elements passed in that array. However, since in your example there is no DOM object to begin with and it’s just an empty array, there is not need to even pass an empty array.

    Calling the jQuery function without any arguments returns an empty set. Taken from jQuery docs,

    Returning an Empty Set

    As of jQuery 1.4, calling the jQuery() method with no arguments returns an empty jQuery set. In previous versions of jQuery, this would return a set containing the document node.

    So, your example would work the same if you had instead called

    $().add(username).add(password);
    

    As other answers have mentioned and the docs say, passing an empty array was required before v 1.4.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I improve this username/password checking? [AcceptVerbs(HttpVerbs.Post)] public ActionResult Login(FormCollection collection) { var
I make a JSONP request using MooTools: var username = 'hsz'; var password =
var newUser = new tblUser() { Email = strEmail, Password = strPassword, DateBirth =
Consider: var something = { wtf: null, omg: null }; My JavaScript knowledge is
This query works great: var pageObject = (from op in db.ObjectPermissions join pg in
Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} What's the
How can I read the username and password from http GET in .NET MVC
I have found this example on StackOverflow: var people = new List<Person> { new
I have written a code and executes well I provide it username and password
If you login here http://freeri.freehostia.com/utanme/image.php Username/password:Demo123 and press any image and when it slides

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.