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);
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user