Internet Explorer Incompatibility - page just shows "[object Object]" WTH?
Asked Answered
C

2

10

When I click on a URL with the link "javascript:$('#dialog-modal').dialog('open');" in Chrome and FF my Jquery dialog loads. In Internet explorer 8 the page source disappears and is replaced with "[object Object]" .. WTH?

Crossfertilization answered 21/2, 2011 at 13:47 Comment(3)
This doesn't work in either IE7, IE8 or IE8 compat modesCrossfertilization
autoOpen works but it still wont open via the link.Crossfertilization
yes it does work in IE8 you just need to know the tricks. see my solution.Torsk
T
7

The problem is IE8 expects you to do something with the click event. The below code works and has been tested in Firefox, chrome, IE8. Notice you need the void(0) to make it work.

   <a class="dialogBtn" href="javascript:$('#layer1').hide();void(0);" style="text-decoration:none;color:#FFF">OK</a>

Or you can use this syntax:

   <a class="dialogBtn" href="javascript:void(0);" onclick="$('#layer1').hide();" style="text-decoration:none;color:#FFF">OK</a>
Torsk answered 15/11, 2013 at 15:20 Comment(0)
C
6

In Internet Explodezor JQuery doesnt seem to work via hyperlinks. Therefore I encapsulated this inside a function and just called the function.

Edit: Seriously whyyy do I have to wait 2 days to accept my own answer....

Crossfertilization answered 21/2, 2011 at 14:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.