• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 651
  • Last Modified:

Firebug says jQuery variable is null, when it is not

I am trying to set up some jQuery to fill in form fields as quantities of things are chosen on a Drupal page. I am following a tutorial to do this. But when I am just trying to see what variables are holding, like:
var a = $('#edit-submitted-users-desktop-users').val();
where edit-submitted-users-desktop-users is the id of a textbox, I get the value is null in Firebug and the Chrome javascript console. I have no idea what I am doing wrong. I usually only use Firebug for CSS issues.
Here is the page I am working on:
1 Solution
Kim WalkerWeb Programmer/TechnicianCommented:
Where do you have this script? It has to come after the page has loaded.
David S.Commented:
Where are you putting that JavaScript statement?  In the console or in the page? If in the page, where in the page?
for me just typing
(without the 'var a ') into the console returns the value in that field if that is all you want
nanharbisonAuthor Commented:
The page has been loaded for hours!
I put this in the command line and got null.
I just put what nullsquid suggested, and that worked. I was just doing what the tutorial said to do. I should always go to experts exchange instead of spending hours trying to figure this out. Other than this, the tutorial is very clear:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now