Now the script works great! I can easily copy anything within the <p> tags to the clipboard. (Seen below, to save you that extra click!)
- <html>
<head>
- <script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.copy.js"></script>
- <script language='Javascript'>
- $(document).ready(function()
{
$("p").click(function()
{
$.copy($(this).text());
});
});
- </script>
</head>
- <body>
- <p>A</p>
<p>B</p>
<p>C</p>
<p>D</p>
<p>E</p>
- </body>
</html>
Is there any easy way of creating custom HTML commands to be interpreted by the script and get the same result?
For instance:
- $("copy").click(function()
{
$.copy($(this).text());
});
- <copy>A</copy>
<copy>B</copy>