Add functionality to Javascript function
<p>I am trying to add a dropdown selection and code button to the Wordpress editor in Javascript.</p>

<p>I found this site that has it done already I am just trying to modify the code slightly.  You can see what I am talking about here, you can select a language from the dropdown and then click the code button on that site.</p>

<p><a href="http://bililite.com/blog/blogfiles/customeditor.html" rel="nofollow">http://bililite.com/blog/blogfiles/customeditor.html</a></p>

<pre><code>jQuery(function ($) {
  edButtons.forEach(function (button, index) {
    if (button.display == 'code') {

      // add language pull down menu
      edButtons[index + 1] = { // insert right after the code button
        html: function (idPrefix) {
          return '&lt;select id="' + idPrefix + 'code_language" data-code-target="' + index + '"&gt;' + '&lt;option&gt;&lt;/option&gt;' + // include a blank option
          '&lt;option&gt;' + languages.join('&lt;/option&gt;&lt;option&gt;') + '&lt;/option&gt;' + '&lt;/select&gt;';
        }
      };
    }
  });

  var languages = ['html', 'javascript', 'lisp', 'pdf', 'php', 'vb'];
  $('body').on('change', 'select[data-code-target]', function () {
    var lang = $(this).val();
   // edButtons[$(this).data('code-target')].tagStart = lang ? '&lt;code class="language-' + lang + '" &gt;' : '&lt;code&gt;';
    edButtons[$(this).data('code-target')].tagStart = lang ? '&lt;pre&gt;&lt;code data-language="' + lang + '"&gt;' : '&lt;pre&gt;&lt;code&gt;';
  });
});
</code></pre>

<p>This code currently insert code like this is no language is selected from the dropdwon...</p>

<pre><code>&lt;code&gt;&lt;/code&gt;
</code></pre>

<p>And this when a Language is seleected...</p>

<pre><code>&lt;code data-language="php"&gt;&lt;/code&gt;
</code></pre>

<p>All I need to do is wrap this in <code>&lt;pre&gt; the above code here &lt;/pre&gt;</code> tags.  I can easily add in the opening pre tag in the code above but I am unable to add the closing tag, I could really use some help from someone who knows Javascript better</p>
