0

Thanks to Refresh (reload) a page once using jQuery? answer I could solve an issue. I have a popup window with a checkbox I want to reflect changes from referred main page, almost instantly. It works great in Safari, Firefox, Chrome, Opera but Internet Explorer.

Thank you

function updateDiv(){
       var ord = getCookie('ordinals');
        if(  ord.indexOf("<?=$ordinal?>")==-1 ){
             document.getElementById("chk<?=$ordinal?>").checked=false//no checked
        }
        else {
            document.getElementById("chk<?=$ordinal?>").checked=true//checked
        }
        $('chk<?=$ordinal?>').html(newContent);
    }

    setInterval('updateDiv()', 1000); // that's 1 second
    ......
    ......
    <body onload="updateDiv(); ....
Community
  • 1
  • 1
dstonek
  • 945
  • 1
  • 20
  • 33
  • You must have forgotten to mention exactly what the problem is in Internet Explorer. – Pointy Nov 14 '11 at 13:44
  • 1
    `setInterval(updateDiv, 1000);` is not only easier to write than `setInterval('updateDiv()', 1000);` but far more efficient as the latter needs to be *evil*uated – Esailija Nov 14 '11 at 13:45
  • I am not a Windows user, I've installed win7 on virtual disk for testing purposes. IE9. I cannot see any errors but a small broken sheet: "Compatibility View..." – dstonek Nov 14 '11 at 15:40
  • Pointy: when the checkbox is checked or unchecked in the main page the change is not reflected in the opened popup checkbox as it does in other browsers. If the popup is manually refreshed or if I close and open it again then the checkbox change is correct. The problem I had in the past in all browsers was that if the popup had been opened in the past, checkbox state was the same as that old one because of browser cache. This is not happening now in IE9: each time the popup is opened the checkbox state is correct, the problem is changing it from the main page while it remains open. – dstonek Nov 14 '11 at 16:10
  • Maybe I can post the site page to understand what I am meaning. – dstonek Nov 14 '11 at 18:28
  • Better see it in real life. [SAMPLE](http://stonek.com/key=chick+kiskadee) There's a "Remember this photo" checkbox near each thumbnail. Click on a thumbnail to open a popup. It also contains a checkbox. Do not close popup and go to referred page. Check the correspondent thumbnail. (photo # is added to a cookie string) All main browsers check the regular photo in opened popup window because of refreshing checkbox but IE does not. – dstonek Nov 14 '11 at 18:58

1 Answers1

1

I think your problem is with:

$('chk<?=$ordinal?>').html(newContent);

Try with this:

var jEl = $('chk<?=$ordinal?>');

jEl.empty();
jEl.append(newContent);
Galled
  • 4,146
  • 2
  • 28
  • 41