Reputation: 1034
I have a problem with IE only; FF, Chrome and Safari do not have this problem. But I think there is something in my code that IE is not liking, because I have used the same technique many times before and had no problem with IE.
Here is the problem:
I have some code that looks like this:
var wrongSide = $('#wrongSide');// IE cannot handle in this case (but has before)
wrongSide.dialog(
{
autoOpen:false,
resizable:false,
modal:true
});
Then in the HTML I have an onchange=function() where the function calls some other function, which looks like this:
function wrongSideTrigger()
{
wrongSide.dialog('open');
}
Please note I am not showing the intermediate function as it is not germane.
The above works fine as stated in FF, Safari and Chrome. However, in IE it does not work, and gives error messages to the effect that the "object does not have this property" for the line that attempts to assign the jquery selector to a var.
However, if I change the code to not use the selector vars, it works for IE. The code then looks like this:
$('#wrongSide').dialog(
{
autoOpen:false,
resizable:false,
modal:true
});
and this:
function wrongSideTrigger()
{
// wrongSide.dialog('open');
$('#wrongSide').dialog('open');
}
then it also works in IE.
The odd thing is that I have done this technique many times and IE has had no trouble with the "jquery selector vars".
I am wondering if I have some syntax error or other which IE is not liking.
Any ideas?
Upvotes: 1
Views: 108
Reputation: 18078
Everything looks fine.
Javascript is victim of some pretty unexpected keywords that are not actually part of the language but I'm pretty certain that "wrongSide" is not one of them; not even on IE.
Just in case, you could try var $wrongSide = ..... ;
Upvotes: 1