Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Button to copy SageMath cell to clipboard

I will be using a link to a simple SageMathCell html page during Canvas quizzes in an online Discrete Math course. I would like to provide an additional "copy" button on the SageCell page that would allow the student to copy both their code and evaluated output into a textbox in a different browser window.

I realize it is now possible to separately cut and past the code and the output into a different textbox, but I would like to keep it as simple as possible. Any suggestions for the additional html that would add the button are appreciated.

Button to copy SageMath cell to clipboard

I will be using a link to a simple SageMathCell html page during Canvas quizzes in an online Discrete Math course. I would like to provide an additional "copy" button on the SageCell page that would allow the student to copy both their code and evaluated output into a textbox in a different browser window.

I realize it is now possible to separately cut and past the code and the output into a different textbox, but I would like to keep it as simple as possible. Any suggestions for the additional html that would add the button are appreciated.

To be more specific, I realize I could create an html button using:

<button onclick="myCopySageInOut()">Copy Sage Cell</button>

and I would need JavaScript code for the myCopySageInOut() function that would copy the input box text, append the output text and place in the clipboard. This is when I could use an example of the JavaScript code.