I've been banging my head against this for the past few hours.
I'm building an HTML chunk with Javascript and appending it to the page's DOM. Problem is this works only if Firebug is running and disabling Firebug doesn't help. When Firebug isn't running the code gets generated but not appended to the DOM (it's not that it's invisible or something).
Safari and Chrome are immune to the problem.
What should I look into?
Following is the incriminated code: if it looks weird it's because it is, and i'm just now refactoring it from the its original german black magic style without comments to self-explanatory jquery
function create_button() {
var textblock = $('div#textblock2');
var token;
token = $(textblock).text();
token = token.split('=')[1];
//delete the text that we parsed to build the btn
textblock.text('');
var form = write_form();
var btn = write_submit_btn(token);
console.log('form: ' + form);
console.log('btn: ' + btn);
textblock.append(form);
textblock.append(btn);
console.log('textblock2 contents:' + textblock.html());
}
function write_form() {
return "<form name='Formular'></form>";
}
function write_submit_btn(token) {
var btn;
if ( token.match(/weiter/) != null )
btn = "<input type='button' name='naechsteFrage' value='weiter' onClick='load_next_question();' />";
else
btn = "<input type='button' name='naechsteFrage' value='zur" + String.fromCharCode(252) + "ck' onClick='load_prev_question()' />";
return btn;
}
create_button();