Quicktag insert multiple lines

This is the format you need to follow,

//double quotes require escaping
var your_html = "<div class=\"one-half first\">1st</div>\n<div class=\"one-half\">2nd</div>\n<div class=\"clear-line\"></div>";

//single quotes do not require escpaing
var your_html="<div class="one-half first">1st</div>\n<div class="one-half">2nd</div>\n<div class="clear-line"></div>";

QTags.addButton( 'my_tag', 'Multi Line', your_html, '' );

I’d just store my html in a var (eg. your_html) then pass that to your QTags.addButton

You can also do,

var more_html = [
'<div class="one-half first">1st</div>\n',
'<div class="etc">etc</div>\n',
'<div class="etc etc">etc etc</div>'
].join('');

QTags.addButton( 'my_tag_again', 'More Multi Line', more_html, '');

Even though this is related to WordPress, its not a WordPress question, technically, because the problem entirely focuses on JavaScript in which is always better served as a question over at Stack Overflow.

But since I’m at it, there’s your answer.

I personally use the second syntax above which is easier to read and make sense of long strings, especially HTML.