JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<title>Contoh saja</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#tombol").click(function(){
var target = $("textarea[name=txt]");
var code = "[code] [/code]";
target.text(code);
})
});
</script>
</head>
<body>
<button id="tombol">Click Me</button>
<textarea name="txt" cols="30" rows="10"></textarea>
</body>
</html>