'How do I disable an input with Umbrella JS?

The UmbrellaJS docs for attr mention that (similar to jQuery) one should know the difference between attr and prop. I've found some discussion on using prop or attr for disabled in jQuery but all I know is Umbrella doesn't have prop and changing disabled doesn't seem to work in Umbrella:

u('#my-input').attr('disabled', true);

u('#my-input').attr('disabled', false);

(tagging jQuery because it's related and someone who knows jQuery well may be able answer this using their intuition)



Solution 1:[1]

I had the same issue and even after doing what @Haroldo Gondim suggested, I could not remove the disabled attribute. This is how I solved it...

u('#my-input').nodes[0].disabled = true;
u('#my-input').nodes[0].disabled = false;

Solution 2:[2]

I believe you cannot remove an attribute of an item.

If you wish to disable all elements you can do this

u('.permissionItem').each( function(e){e.disabled = false;});

Or if it is just one item, you can do

u('.permissionItem').first().disabled = false;

.first() and the foreach loop both give the node, instead of the umbrella element.

Solution 3:[3]

The following code should work fine.

u('#my-input').attr('disabled', 'disabled');

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 b4tch
Solution 2 Timberman
Solution 3 Haroldo Gondim