If you are interested in a JavaScript only solution, give this a try:
ui html panel("<!DOCTYPE html>
<html>
<head>
<script type=\"text/javascript\" src=\"http://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.1.0.min.js\"></script>
<script type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js\"></script>
</head>
<body>
<textarea data-clipboard-text=\"\" id=\"txtWords\" cols=\'50\' rows=\'10\'></textarea>
<button id=\"btnReplace\">Replace Words&