Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
589 views
in Q2A Core by

I tried to override the Error function on theme base to add a closing button but it seems that the error message HTML is generated with Javascript through this function :
 

qa_ajax_post('vote', {postid:postid, vote:vote, code:code},
function(lines) {
if (lines[0]=='1') {
qa_set_inner_html(document.getElementById('voting_'+postid), 'voting', lines.slice(1).join("\n"));
 
} else if (lines[0]=='0') {
var mess=document.getElementById('errorbox');
 
if (!mess) {
var mess=document.createElement('div');
mess.id='errorbox';
mess.className='qa-error';
mess.innerHTML=lines[1];
mess.style.display='none';
}
 
var postelem=document.getElementById(anchor);
var e=postelem.parentNode.insertBefore(mess, postelem);
qa_reveal(e);
 
} else
qa_ajax_error();
}
);
 
 
I am new to JS, any help please to add HTML Button and making works through JS.

thank you !

2 Answers

0 votes
by
 
Best answer

Thanks Scott ! 

It does work  by inserting  the button into mess.innerHTML , using javascript concatination,
As for other notices, the tip is to add button to the error function on theme-base file.

Thanks again 

+1 vote
by
The contents of the error box are set to what is returned from the AJAX call (i.e. `lines[1]`). So you can find where that content is generated (it should be one of the qa-ajax-*.php files) then add some HTML to that.
...