- Set the data- attribute on the lightning-input-field
<lightning-input-field data-field-name-id="AccountName" field-name="AccountName__c"></lightning-input-field>
- Use the this.template.querySelector() to find the correct lightning-input-field
let field = this.template.querySelector("lightning-input-field[data-field-name-id=AccountName]"); - Print the value
console.log(field.value);
- Set a new value to for the lightning-input-field
field.value="new value";
Ta Da 🙌
Comments
Post a Comment