How come this button does not become disabled? [closed]

1 week ago 7
ARTICLE AD BOX

I have this button and input elements, as well as a jQuery keyup event:

<input b-2uzqter5id="" type="text" id="songName" data-lmo-id="zELEpligCc"> <button b-2uzqter5id="" type="button" id="btnOKNewModal">OK</button> jQuery('#songName').on('keyup', function() { jQuery('#btnOkNewModal').prop('disabled', jQuery('#songName')[0].value.length == 0); });

What I want to achieve is that the button becomes disabled when songName is empty, and enabled if not. When I place a breakpoint on the jQuery('#btnOkNewModal')... line, I find that

the keyup event works as expected, jQuery('#songName')[0].value.length is indeed 0 when the songName textbox does not contain any text, and is > 0 if it does.

The disabled state of the button does not change however. The button remains enabled. Elsewhere in my code I set .prop('disabled', <true/false>) on buttons as well and it works fine. What could be happening here why it does not work, and how do I solve it?

Read Entire Article