JSFiddle - React, Tailwind, and code Playground

by codyc54321

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<p>Enter your Ipython text and I'll clean it up</p>

<form action"." method="post">
    <input type='hidden' name='csrfmiddlewaretoken' value='inYPMbWKLTwwIdSHYbcfYwWWIKicgglj' />
    <div style=""><p><label for="id_code">Code:</label> <textarea cols="40" id="id_code" name="code" rows="10">
In [9]: match = re.match(in_rgx, string)

In [10]: match
Out[10]: &lt;_sre.SRE_Match at 0x7f90674cf3d8&gt;

In [11]: match.gro
match.group      match.groupdict  match.groups     

In [11]: match.group()
Out[11]: &#39;In [3]: &#39;

</textarea></p></div>
    <div style="clear:left;"><input type="submit" value="Submit"/></div>
</form>

<br/>
<button onclick="copyToClipboard('#clean-code')">Copy to clipboard</button>
<br/>
<p id="clean-code">match = re.match(in_rgx, string)<br /><br />match<br />#&lt;_sre.SRE_Match at 0x7f90674cf3d8&gt;<br /><br />match.gro<br />match.group      match.groupdict  match.groups     <br /><br />match.group()<br />#&#39;In [3]: &#39;<br /></p>

<form action"." method="post">
    <input type='hidden' name='csrfmiddlewaretoken' value='inYPMbWKLTwwIdSHYbcfYwWWIKicgglj' />
    <div style=""><p><label for="id_code">Code:</label> <textarea cols="40" id="id_code" name="code" rows="10">
match = re.match(in_rgx, string)

match
#&lt;_sre.SRE_Match at 0x7f90674cf3d8&gt;

match.gro
match.group      match.groupdict  match.groups     

match.group()
#&#39;In [3]: &#39;

</textarea></p></div>
    <div style="clear:left;"><input type="submit" value="Submit"/></div>
</form>

JavaScript

function copyToClipboard(element) {
      var $temp = $("<input>");
      $("body").append($temp);
      $temp.val($(element).text()).select();
      document.execCommand("copy");
      $temp.remove();
    }