.css("top") is returning "undefined"
Hi,
I am trying to set the property of a DIV element using the .css(...) method, but it keeps returning "undefined" both before and after I set the value. Here is the code snippet:
var isense =
{
$dialog: $('#isense'),
$box: null, // gets set before call to ShowDialog
...
ShowDialog: function (data)
{
var height = this.$box.height() + 9;
var $offset = this.$box.offset();
var content = $('<div />').append($('#isensetemplate').tmpl(data)).html();
$('.isenseperson').remove();
this.$dialog.append(content);
this.$dialog.css("left", $offset.left);
this.$dialog.css("top", $offset.top + height);
this.$dialog.show();
},
...
}
I've stepped through in the IE9 debugger (my code has to run in IE), and this.$box is an object (jquery object) wrapping the element I am trying to show the DIV at. The $offset has the right numbers (they are positive and look to be the right location).
The problem is, after I call this.$dialog.css("left", $offset.left), the value of this.$dialog.css("left") is "undefined". It's "undefined" both before and after the call. The same for "top". Then the call to this.$dialog.show() doesn't seem to do anything, that is, I don't see the dialog (the style property for that dialog is initially set to include "display: none;").
Also, the content variable does hold some HTML, and it looks right, so I don't think that's the issue. Any ideas? I've seen the css properties return "undefined" before and I couldn't figure out why.
I am using Jquery 1.4.4, and the code is running inside a webbrowser control in .NET which is IE7.
Quentin