You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to disabled all of input field values dynamically based on button click Uses of foreach loop in javascript in Lightning Web component Salesforce – LWC
#77
Open
vijayk3327 opened this issue
Jul 17, 2023
· 0 comments
In this post we are going to learn about How to disabled all of input field values dynamically based on button click Uses of ‘foreach loop’ in javascript in Salesforce Lightning Web component – LWC.
→ Get source code live demo link:-
Step 1:- Create Lightning Web Component : disableInputLwc.html
`
How to disable the input fields on button click in LWC
Step 2:- Create Lightning Web Component : disableInputLwc.js
` import { LightningElement } from 'lwc';
export default class DisableInputLwc extends LightningElement {
disableHandleClick(){
this.template.querySelectorAll('lightning-input').forEach(item=>{
item.disabled=true;
}`
Step 3:- Create Lightning Web Component : disableInputLwc.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>45.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> </targets> </LightningComponentBundle>
Step 4:- Create Lightning Application : disableInputLwcApp.app
<aura:application extends="force:slds"> <c:disableInputLwc/> </aura:application>
→ Get source code live demo link:-
The text was updated successfully, but these errors were encountered: