i have statement like this
var a = $("#txt1").val().trim()
how should check if 'a' is not empty
i have statement like this
var a = $("#txt1").val().trim()
how should check if 'a' is not empty
I think
if (a) { /* a is not empty */ }
should do the trick, perhaps unless a contains "false" (not sure of that) but I suppose you could do
if (a !== null && a.length != 0) { /* a is not empty */ }