Skip to main content

Bug Tracker

Side navigation

#7525 closed bug (worksforme)

Opened November 15, 2010 10:19PM UTC

Closed December 01, 2010 05:42PM UTC

Last modified March 13, 2012 05:08PM UTC

j is null

Reported by: anonymous Owned by: anonymous
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

j is null

[Break on this error] - FireBug:

l.test(j)){var s=t.getElementsByTagNam...else if(K)for(z in j){if([z],

Attachments (0)
Change History (10)

Changed November 15, 2010 10:32PM UTC by addyosmani comment:1

owner: → anonymous
status: newpending

Please submit a valid test case that reproduces the issue you are experiencing (ideally on jsFiddle) so that we can investigate this issue further.

Changed November 18, 2010 12:51PM UTC by lsolova comment:2


I had same problem, because I create a form on the fly. It seems to me, that this problem is caused by a text area removed from HTML source, but not removed from tinyMCE sources. I found a forum entry about removing: . It works for me.


Laszlo Solova

Changed December 01, 2010 05:42PM UTC by addyosmani comment:3

resolution: → worksforme
status: pendingclosed

Closing as no reproducible test case has been provided, despite request. Please feel free to re-open should a valid test case become available

Changed December 01, 2010 06:15PM UTC by rwaldron comment:4

Additionally, please test with a non-minified copy of the source, as this:

[Break on this error] - FireBug: l.test(j)){var s=t.getElementsByTagNam...else if(K)for(z in j){if([z], meaningless.

Changed December 01, 2010 07:52PM UTC by ajpiano comment:5

Changed December 21, 2010 05:01PM UTC by escamosomix comment:6

_comment0: I think he problem is that jquery is being called twice... \ i made a little test writing twice the script declaration of jquery import \ <script ...></script>1292951081218198
_comment1: I think the problem is that jquery is being called twice in the same page... \ i made a little test writing twice the script declaration of jquery import \ <script ...></script>1292962729688073

I did some tests using jquery in my apps, using 3 web browsers (ie, firefox, chrome) and, when it happen to me, i found that a variable used in jquery.each function has value 'null'. for solve, I checked every .each call i used.

the result: one of the variables used in the each (that is a json array) was null.

solution (at least for my case): check for the null variable and ensure that it wont happen again (in jquery.each - ensure that arrays used in wont be null).


Changed July 10, 2011 12:07AM UTC by comment:7

I agree with escamosomix. I had a similar case. What I did was called two ajax functions to get some json data into two separate array of objects. Then, below these two ajax functions was a simple function that used these two arrays to manipulate a third array using $.each() which would pass through each element of array 1 and array 2. The problem was that the third function would attempt to manipulate the arrays before the ajax functions returned values to them. So, null values passed to $.each and this error popped up.

How did I find this out?

Well, this error would only show up while running application, and not in debug mode. Because in debug mode, I would be using breakpoints and it would provide sufficient time for the ajax functions to calculate the values for this function to use these values.


The problem states itself clearly. I called the second ajax function in the success option of the first, and the third normal function in the success option of the second so that these functions get called one after another, and not concurrently. Problem solved !! (At least for me).

Changed July 10, 2011 03:07AM UTC by rwaldron comment:8

I've just read through this entire thread and I'm pretty sure that 3 different issues are being discussed. With regard to the most recent comment by imaginesamant: It sounds like you're trying to do synchronous operations on asynchronously created data - you need to use the returned deferred object of $.ajax and pass it to $.when( deferred, deferred, deferred ).then(function() { //do this stuff when the async deferreds are _all_ resolved })

Changed July 22, 2011 07:37AM UTC by anonymous comment:9

imaginesamant@… is right.

Changed February 08, 2012 09:21PM UTC by Ixalmida comment:10

I had this problem and solved it thanks to the post by escamosomix. Just thought I'd add a code fragment to help out anyone who is still floundering:

// Get new messages in forum
function forumRefresh() {
    // Script that returns JSON or null
    var url = "forum_refresh.php";

    // Run script
    $.getJSON(url, function(data) {
        // Catch null data error...
        if (data == null)

        // Now that data != null, the $.each call is okay!
        $.each(data, function() {

Note: ideally, jQuery should give better feedback than "j is null" or just ignore the null value.