Changed textbot to text only. Updated logic as well.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user