Solved

Firebug says jQuery variable is null, when it is not

Posted on 2012-03-29
4
633 Views
Last Modified: 2012-03-29
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:
http://www.cloudconnect.net/pricing-estimate
0
Comment
Question by:nanharbison
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 22

Expert Comment

by:Kim Walker
ID: 37784945
Where do you have this script? It has to come after the page has loaded.
0
 
LVL 42

Expert Comment

by:David S.
ID: 37784965
Where are you putting that JavaScript statement?  In the console or in the page? If in the page, where in the page?
0
 
LVL 3

Accepted Solution

by:
nullsquid earned 500 total points
ID: 37785021
for me just typing
$('#edit-submitted-users-desktop-users').val();
(without the 'var a ') into the console returns the value in that field if that is all you want
0
 
LVL 17

Author Comment

by:nanharbison
ID: 37785044
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:
http://1013.fi/cms/interactive-drupal-web-forms-jquery-javascript-library
Thanks
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Powershell GUI 11 66
Python sort list of tuples, skipping column 2 27
Add somewhat of a wildcard to your javascript 12 31
Validating number not work with decimal 4 29
This article discusses how to create an extensible mechanism for linked drop downs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question