views:

96

answers:

3

Hi,

I have a page that uses JQuery for an ajax call. Viewing the page in Chrome shows the following error in the developer console:

 Uncaught TypeError: Cannot set property 'display' of undefined

While the same page runs in firefox 3.6.6 without any error in the firebug console.

The error emanates from a line in j-query-1.4.2 ( as shown in the chrome console)

Anyone else facing similar issues ?

Basically, I am using a DatePicker which shows up within a Modal Dailog.

Here is the code :

$(document).ready(function () {
$("#inputs input[name=dateField]").datepicker(
        {
            showOn: 'both',
            dateFormat:'dd/mm/yy HH:II TT',
            showButtonPanel: true, 
            maxDate: '+0D',
            buttonImage:'calendar.gif',
            buttonImageOnly: true,
        }
);
 });
A: 

Some browsers are just picky about setting properties on elements that theoretically don't support them. Like IE doesn't like setting visibility on . My guess is that you try to tie jquery with wrong tag. But still - give a code.

ThA-B
A: 

I think that there is no such INPUT field named "dateField" (for the attribute "name"), inside its parent container whose "id" attribute's value is "inputs". Or maybe the parent container element is not defined with its proper "id" attribute's value.

Hope it helps.

Knowledge Craving
Nope, they both exist.
Icarus
+1  A: 

I suggest you start trying your lines of code out in chrome's developer console. Open up the Developer Tools while on your page (so all of your code is loaded) and go to the console tab. Type/Paste into the console:

$("#inputs input[name=dateField]")

And see if that returns an object with a length. If the object returned only has "context", "selector" and "__ proto__" properties, jquery found nothing. If it also has a "length" property, and properties that are named numbers ("0", "1", etc), then it found something (or multiple somethings).

From there, you can try other code to see what Chrome will say.

Tustin2121