0
(function() {

if ( !window.BG || typeof window.BG !== 'object') {
    window.BG = {};
}
var BG = window.BG;

BG.votdWriteCallback = function(json) {
    var votd = json.votd;
    document.write('<div>' + votd.text);
    document.write(' </br><a target="_blank" href="' + votd.permalink +'">' + votd.display_ref + '</a>');
    if (votd.audiolink) {
      document.write(' <a href="' + votd.audiolink + '" title="Listen to chapter"><img alt="Listen to chapter" src="//www.biblegateway.com/assets/images/audio/sound.gif" border=0/></a>');
    }
    document.write('</div>');
};

window.BG = BG;

})();

Want to clean this script because for some reason it's breaking my HTML divs but I can't see where the problem is.

Tim Diekmann
  • 5,740
  • 9
  • 30
  • 53
dexter4000
  • 77
  • 7
  • 2
    What do you mean by "breaking"? It might help to create a [working demonstration](https://stackoverflow.com/help/minimal-reproducible-example) of the issue. Also see [HTML 5: Is it
    ,
    , or
    ?](https://stackoverflow.com/questions/1946426/html-5-is-it-br-br-or-br)
    – showdev Jan 30 '20 at 00:20
  • this is unclear. what BG is suposed to be? – Mister Jojo Jan 30 '20 at 00:31
  • 1
    you really should not use document.write – epascarello Jan 30 '20 at 00:46
  • See [Why is document.write considered a “bad practice”?](https://stackoverflow.com/questions/802854/why-is-document-write-considered-a-bad-practice) – showdev Jan 30 '20 at 00:50

1 Answers1

0

sorry, just saw now that im writing a extra div in the document.write('</div>');

I know its bad practice to use document.write. This is some old code that im trying to clean up

dexter4000
  • 77
  • 7