How to Disable ui.button in Lightning Component

This may be broader question on how we set HTML attributes inside Lightning?
The docs state ui:button has disabled property and it works fine in VFP for all VF components. But how do I set this attribute inside Lightning JS Controller?
Nothing seem to work try several options in component controller JS;

var btn = event.getSource();
btn.disabled = true;
btn.attributes.disabled = true;

… many others but cannot effect the button state to set disabled on click event.
No syntax errors (figure no compiled code JS) just not working.


The right syntax to do this is below

var btn = event.getSource();
btn.set("v.disabled",true);//Disable the button

Source : Link , Question Author : takumi3t9 , Answer Author : Mohith Shrivastava

Leave a Comment