You need to sign in to do that
Don't have an account?
Courtney Mosley
Dynamically expanding comment box in Salesforce Lightning
Hello everyone.
I am currently working on a task where I need the comment box on my page to expand dynamically as a user types. I have the current code in my cmp file. Would I need to include "onkeyup=AutoGrow" to the cmp file? I hope I explained this correctly. Thank you for any help!
<div onkeypress="{!c.handleEnterKey}"
id="user-input-textarea"
class="">
<lightning:textarea maxlength="400"
label="Comment"
name="newCommentName"
placeholder="Write a comment..."
messageWhenValueMissing="{!$Label.c.RC_Comment}"
value="{!v.newCommentBody}"
aura:id="commentTextBox"
class="llr-ltng-form-ele hide-label disabled-err-msg case-comment-textarea"
disabled="{!v.caseType == 'Item' || v.isSubmitting}"
/>
</div>
I am currently working on a task where I need the comment box on my page to expand dynamically as a user types. I have the current code in my cmp file. Would I need to include "onkeyup=AutoGrow" to the cmp file? I hope I explained this correctly. Thank you for any help!
<div onkeypress="{!c.handleEnterKey}"
id="user-input-textarea"
class="">
<lightning:textarea maxlength="400"
label="Comment"
name="newCommentName"
placeholder="Write a comment..."
messageWhenValueMissing="{!$Label.c.RC_Comment}"
value="{!v.newCommentBody}"
aura:id="commentTextBox"
class="llr-ltng-form-ele hide-label disabled-err-msg case-comment-textarea"
disabled="{!v.caseType == 'Item' || v.isSubmitting}"
/>
</div>
Use this css in your lightning component.
You can tweak the values to get the desired effect.
For other solution please visit : https://blog.invoiceberry.com/2011/03/dynamically-change-the-height-of-a-textarea-based-on-the-text-javascript/
Hope this helped.Please mark this as best answer if so.
Thanks,
Gulafsha
I've been struggling to find a good solution for a day now, any help would be highly appreciated!
Cheers,
Alex