Depends on what the value of #ron is. If it is an input the possible values are text, empty or spaces.
For example:
!"" // Negating an empty string gives you TRUE
!" " // Negating a space gievs you FALSE
!"any text 123" // Negating any text gives you FALSE
!undefined // Negating undefined gives you TRUE, read on...
It can also depend on the existance of #ron. If the element with id #ron does not exist, or does not have a "value" property (is not an input). jQuery will always return undefined which could explain why !undefined will always return true and your else path is never reached.
Recap:
- Check if
#ron exists on the html eg. $('#ron').length should return 1
- Check that
#ron is an input or textarea so that $('#ron').val() wont return undefined
- Check the values in the textarea and trim it to avoid spaces vs empty string scenarios