I have this jquery code
if (($("#RdbDateRange").is(':checked'))
&& (!$("#CldrFrom").val())
&& (!$("#CldrTo").val())) {}else{}
RdbDateRange is ID for radio button.
CldrFrom is ID for input text
CldrTo is ID for input text.
I want to do something when the radio is selected and both of the inputs not empty.
but that code go inside the if even when the inputs empty.
why please?
falsein a boolean context. Try applying$.trim()to filter out whitespace. Note that you do not have to explicitly test against the empty string or uselength, as all the answers you received so far would like you to believe.