WIP update maxLength.
This commit is contained in:
parent
7575e03866
commit
5104ee4eca
2 changed files with 3 additions and 3 deletions
|
|
@ -28,12 +28,12 @@ export default {
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
const my_textarea = document.getElementById("textarea-comments");
|
const my_textarea = document.getElementById("textarea-comments");
|
||||||
const remaining = document.getElementById("charactersremaining");
|
const remaining = document.getElementById("charactersremaining");
|
||||||
const remain = 250;
|
const remain = this.maxLength;
|
||||||
|
|
||||||
my_textarea.addEventListener("input", () => {
|
my_textarea.addEventListener("input", () => {
|
||||||
const total = remain - my_textarea.value.length;
|
const total = remain - my_textarea.value.length;
|
||||||
const color = total < remain * 0.1 ? "red" : null; //Change text to red when the total remaining goes below 25;
|
const color = total < remain * 0.1 ? "red" : null; //Change text to red when the total remaining goes below 25;
|
||||||
remaining.innerHTML = `${total}/250 characters remaining`;
|
remaining.innerHTML = `${total}/${this.maxLength} characters remaining`;
|
||||||
remaining.style.color = color;
|
remaining.style.color = color;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<textareaquestion
|
<textareaquestion
|
||||||
cmsWidgetName="CustomerDetailsTextAreaLabelText"
|
cmsWidgetName="CustomerDetailsTextAreaLabelText"
|
||||||
:labelText="textAreaLabelCopy"
|
:labelText="textAreaLabelCopy"
|
||||||
maxLength=250
|
maxLength=50
|
||||||
isRequired
|
isRequired
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue