You've already forked dencode.xrg.es
This commit is contained in:
21
app/public/js/form.js
Normal file
21
app/public/js/form.js
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
(function() {
|
||||
const form = document.getElementById('form');
|
||||
const textarea = document.getElementById('str');
|
||||
|
||||
// Change the form method between GET and POST based on the textarea length
|
||||
const updateFormMethod = () => {
|
||||
const maxLength = 1024;
|
||||
const textLength = textarea.value.length;
|
||||
console.log(textLength);
|
||||
|
||||
if (textLength > maxLength) {
|
||||
form.method = 'post';
|
||||
} else {
|
||||
form.method = 'get';
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', updateFormMethod);
|
||||
textarea.addEventListener('input', updateFormMethod);
|
||||
})();
|
Reference in New Issue
Block a user