Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#7525 closed bug (worksforme)

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(s.call(j[z],

Change History (10)

comment:1 Changed 12 years ago by addyosmani

Owner: set to 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.

comment:2 Changed 12 years ago by lsolova


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: http://tinymce.moxiecode.com/punbb/viewtopic.php?id=17346 . It works for me.

Bye, Laszlo Solova

comment:3 Changed 12 years ago by addyosmani

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

comment:4 Changed 12 years ago by Rick Waldron

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(s.call(j[z],

...is meaningless.

comment:6 Changed 12 years ago by escamosomix

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).


Last edited 12 years ago by escamosomix (previous) (diff)

comment:7 Changed 12 years ago by [email protected]

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.

Solution: 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).

comment:8 Changed 12 years ago by Rick Waldron

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 })

comment:9 Changed 12 years ago by anonymous

[email protected]… is right.

comment:10 Changed 11 years ago by Ixalmida

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.

Note: See TracTickets for help on using tickets.