Changed textbot to text only. Updated logic as well.

This commit is contained in:
2026-01-19 16:59:26 +01:00
parent cf1ceae94c
commit d9d93d8522
2 changed files with 6 additions and 6 deletions

View File

@@ -46,22 +46,22 @@ hashBtn.addEventListener('click', async () => {
}
const data = await res.json();
result.value = data.hash;
result.textContent = data.hash;
});
clearBtn.addEventListener('click', () => {
password.value = '';
salt.value = '';
result.value = '';
result.textContent = 'Result will appear here';
});
resultBtn.addEventListener('click', async () => {
if (!result.value) {
if (!result.textContent || result.textContent === 'Result will appear here') {
alert('Nothing to copy.');
}
try {
await navigator.clipboard.writeText(result.value);
await navigator.clipboard.writeText(result.textContent);
alert('Copied to clipboard.');
} catch (err) {
alert('Failed to copy: ' + err);

View File

@@ -37,9 +37,9 @@
</div>
<label for="result">Result</label>
<label>Result</label>
<pre id="result" class="result-box">Result will appear here</pre>
<button id="resultBtn" type="button">Copy result</button>
<textarea id="result" rows="4" readonly placeholder="Result will appear here"></textarea>
</div>
<script src="/static/js/main.js"></script>