Edit HTML

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Simple Calculator</title> </head> <body> <textarea id="inputText" rows="2" cols="30" placeholder="Paste your text here..."></textarea> <br> <input type="text" id="result" readonly> <button onclick="calculateSum()">Calculate Sum</button> <script>function calculateSum() { const inputText = document.getElementById('inputText').value; const numbers = inputText.match(/-?\d+(\.\d+)?/g) || []; const sum = numbers.reduce((acc, num) => acc + parseFloat(num), 0); document.getElementById('result').value = sum; copyToClipboard(); } function copyToClipboard() { const resultField = document.getElementById('result'); resultField.select(); resultField.setSelectionRange(0, 99999); // For mobile devices document.execCommand('copy'); }</script> </body> </html>
Back to Home

Preview

URL: