A space to discuss online store customization, theme development, and Liquid templating.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hi
I have liquid code which puts a textarea on my site:.
<textarea id="Customisation" maxlength="10"
style="width:100%;height:50px;font-size:10pt;resize:none;scrollbar-width: none;" placeholder="Enter Text"> </textarea>
The maxlength attribute works in desktop and mobile mode under development however it doesn't restrict entry to 10 characters on my mobile phone -using using different browsers including Chrome
Any ideas?
Hi @Emma_B2 , The "maxlength" in <textarea> is inconsistent across different devices. To fix the issue try adding the below script to your file code.
<script>
const textarea = document.getElementById("Customisation");
textarea.addEventListener("input", function() {
const maxlength = this.getAttribute("maxlength");
if (this.value.length > maxlength) {
this.value = this.value.slice(0, maxlength);
}
});
</script>
AT...