?
Solved

Firebug says jQuery variable is null, when it is not

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 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