Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created July 14, 2015 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/7966788127e2e08eafe2 to your computer and use it in GitHub Desktop.
Save chuck0523/7966788127e2e08eafe2 to your computer and use it in GitHub Desktop.
$('.font-box').click(function(){
//一度カンマを外す
var text = $('#fixedTextarea').text().replace(/","/g, '""');
$(this).toggleClass('selected');
var fontText = '\"' + $(this).text() + '\"';
if($(this).hasClass('selected')) {
text += fontText;
} else {
text = text.replace(fontText, '');
}
text = text.replace(/""/g, '","');
$('#fixedTextarea').text(text);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment