Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to locate source of Warning: Empty string passed to getElementById()

Warning: Empty string passed to getElementById().
Source File: chrome://browser/content/browser.xul
Line: 0

Some days ago I started getting the above message while developing my site. Things are working as they should (or at least I think they are), but I want to find out where this is coming from. I use jQuery so do not use getElementById() directly. Plus I have Firebug and the Web Developer extension for Firefox running.

I could laboriously put in code to check for an empty string being given to a jQuery selection or maybe look into jQuery itself, but my skills are minimal, so I'm asking here if anyone has offhand a good idea for quickly locating the source of the warning messages.

like image 999
Terry Avatar asked May 28 '12 21:05

Terry


3 Answers

Source File: chrome://browser/content/browser.xul

This means that the error is in a Firefox extension, not in your code.

like image 185
lanzz Avatar answered Nov 12 '22 03:11

lanzz


Was receiving this warning in Firefox.

I just came across this warning and found that there were labels for input fields but the labels for attribute was not set/empty so just completing the for attribute fixed this issue for me.

// Label's for attribute not set which caused the warning in FF

e.g. <label for=''>Text</label><input type="text" name="text" id="text" value="" />
like image 32
MattyGT Avatar answered Nov 12 '22 02:11

MattyGT


If you are querying by '#' selector -- ensure the selector is unique (as it should be) or you will end up with this error in ff

like image 8
user1898553 Avatar answered Nov 12 '22 03:11

user1898553