0

enter image description here

hello im currently express this var with

 var consultRemark = "1. Valid Date : 1 Week , Based on Quote Date  \r\n  " + " 2. Payment Condition : Cash only Conditions may Apply. \r\n " + "3. Period : may changed after customer's deal.";
    var action = component.get("c.getInitData");

1 Answer 1

1

<aura:unescapedHTML> tag should be used here. And instead of \r\n, use HTML tag <br/> for line breaks.

https://developer.salesforce.com/docs/component-library/bundle/aura:unescapedHtml/specification

 var consultRemark = "1. Valid Date : 1 Week , Based on Quote Date  <br/> 2. Payment Condition : Cash only Conditions may Apply. <br/> 3. Period : may changed after customer's deal.";
component.set("v.auraAttributeVar",consultRemark);

<aura:unescapedHtml value="{!v.auraAttributeVar}" />

To put new lines in Lightning:inputRichText, replace <br/> with <p/>

var consultRemark = "1. Valid Date : 1 Week , Based on Quote Date  <p/> 2. Payment Condition : Cash only Conditions may Apply. <p/> 3. Period : may changed after customer's deal.";
    component.set("v.auraAttributeVar",consultRemark);

<lightning:inputRichText value="{!v.auraAttributeVar}" placeholder="Type something interesting"/>
3
  • Thanks for reply but is there any way to express this directly on a lightning:input markup?
    – Jayee
    Commented Mar 4, 2019 at 7:17
  • 2
    I dont think you can put new line in lightning:input component. However you can use lightning:inputRichText component for this. Please see the updated answer. Commented Mar 4, 2019 at 9:31
  • 1
    i think this is clear solution for putting a new line. Thanks bunch
    – Jayee
    Commented Mar 5, 2019 at 0:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .