function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Stefaan Somers 11Stefaan Somers 11 

Modify track property trhough this-variable in context of field

I have a Lightning component with the following property
@track disabled = false;

I now also have the following code :
let allInputFields = this.template.querySelectorAll('lightning-input'); allInputFields.forEach(function(input){ input.addEventListener('focus', function(event) { this.value=''; this.className = 'input-focus'; //this.disabled=true; },false);

When I execute the code in bold, it's not acting on the @track property. How can I do this?
ShivankurShivankur (Salesforce Developers) 
Hi Stefaan,

Check out the example over below link to understand more about tracked properties in LWC:
https://rajvakati.com/2019/01/01/tracked-properties-in-lightning-web-component/

Hope above information helps. Please mark as Best Answer so that it can help others in future.

Thanks.