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);