?
Solved

Firebug says jQuery variable is null, when it is not

Posted on 2012-03-29
4
Medium Priority
?
647 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
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 43

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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

839 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