So, in this question I explained my whole situation and to save space I am not going to repost my whole situation
But here is the answer to the question that I am having problems with
function form_submit (event) {
var form, bClickNotSubmit;
if (event && event.type == 'click') {
bClickNotSubmit = true;
form = document.getElementById ('quick_reply_form');
}
else {
bClickNotSubmit = false;
form = event ? event.target : this;
}
var arTextareas = form.getElementsByTagName ('textarea');
for (var i = arTextareas.length - 1; i >= 0; i--) {
var elmTextarea = arTextareas[i];
elmTextarea.value = "[font=Tahoma][color=white]" + elmTextarea.value + "[/color][/font]";
}
if ( ! bClickNotSubmit ) {
form._submit();
}
}
window.addEventListener ('submit', form_submit, true);
document.getElementById ('quick_reply_submit').addEventListener ('click', form_submit, true);
HTMLFormElement.prototype._submit = HTMLFormElement.prototype.submit;
HTMLFormElement.prototype.submit = form_submit;
So this works all fine and dandy in firefox, but I have now realized that there is a issue in chrome. When it quick reply form is submitted on the page, the function seems to run, in the sense that you can see the stuff get added to the beginning and the end of the text, but it seems to not do it fast enough because the form gets submitted to the server before the text is added
does anyone know how to remedy this?
Not tested, but try changing this:
To this: