javascript - Changing properties in IE using JQuery; changes only applied when debugging -


i have simple script that's run @ load separate js file. setup this:

    var ddlperiodevan = $('[id$=ddlperiodevan]');     var ddlperiodetot = $('[id$=ddlperiodetot]');     chkperiodevantot = $('[id$=chkperiodevantot]').length > 0 ? $('[id$=chkperiodevantot]') : $('[id$=rbperiodevantot]');     var periodebereik = { van: 'ddlperiodevan', tot: 'ddlperiodetot', err: 'ddlperiode', chk: chkperiodevantot, label: 'periode' };     if (ddlperiodevan.length > 0 && ddlperiodetot.length > 0) {         if (chkperiodevantot.length > 0) {             chkperiodevantot.change(periodebereik, changedchecknummerbereik);              if (chkperiodevantot.prop('checked')) { // checkbox aangevinkt, maak de waardevelden bewerkbaar                 ddlperiodevan.prop('disabled', false).prop('readonly', false).css('background-color', '#ffffff');                 ddlperiodetot.prop('disabled', false).prop('readonly', false).css('background-color', '#ffffff');             } else { // disable en readonly aanzetten, achtergrond blauw en tekst op (leeg indien textbox / defaultwaarde indien dropdown)                 // debugger gets here , changes properties correctly                 // when there no breakpoint, changes have no effect                 // when there breakpoint, changes made , remain visible                 ddlperiodevan.prop('disabled', true).prop('readonly', true).css('background-color', '#aacaf4');                 ddlperiodetot.prop('disabled', true).prop('readonly', true).css('background-color', '#aacaf4');             }         } 

at initial page_load, chkperiodevantot not checked , ddlperiodevan , ddlperiodetot should disabled, readonly , have different background color.

this works fine in other browsers (of course), ie thinks differently , don't know why.

the weird thing is, when developer tools in ie11 , set breakpoint in file. breakpoint gets hit , code ddl's changed expected! ie refresh dom somewhere changes lost?

edit

i figured out setting breakpoint isn't necessary. having f12 developer tools window open trick. loads correctly. closing f12 , refreshing breaks again...

all right, i've got microsoft logic right here:

in "modern" browsers, window.console created if don't have debugger open. ie, window.console undefined if debugger closed.

an internal error of never see being thrown causing scripts stop executing...

so don't use window.console (you shouldn't in production code) or check if console undefined before using it.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -