You need to sign in to do that
Don't have an account?
Raghav T
How to enable/disable the lightning button in LWC.
Hi,
I have been creating LWC component, and there i have one button called "Submit". So I wanted to make that button disable on the pageload and make it enable again after button click(Another method).
Code:
html=>
checkSubmit=true;
//this is a method on another button.
addRow(event) {
//window.alert("Import Alert!!!");
this.indx++;
this.partsList.push(this.record);
checkSubmit=false;
}
I have been creating LWC component, and there i have one button called "Submit". So I wanted to make that button disable on the pageload and make it enable again after button click(Another method).
Code:
html=>
<lightning-button variant="success" class="slds-m-left_x-small" label="Submit" title="Submit" disabled={checkSubmit}></lightning-button>js=>
checkSubmit=true;
//this is a method on another button.
addRow(event) {
//window.alert("Import Alert!!!");
this.indx++;
this.partsList.push(this.record);
checkSubmit=false;
}
I see you have already added the ‘disabled’ property to the lightning-button tag
Came across these related posts that might help
https://salesforce.stackexchange.com/questions/325596/lwc-only-enable-button-if-options-are-available
https://salesforce.stackexchange.com/questions/315680/how-to-conditionally-disable-the-lwc-standard-datatable-buttons
https://salesforce.stackexchange.com/questions/353141/i-would-like-to-disable-a-custom-button-once-after-clicking-it-in-lwc
Thanks
So here the issue is that after adding this disabled property i am not able to achieve the required solution.
Its actulaly not making button enable onclick of method
HTML:
JS: