How I get the content of lookup field rather than record ID in NEM?

How I get the content of lookup field rather than record ID in NEM?

Hi, 

I need to make tips  according to  the lookup field contents, such as :

if ( lookup = "male" )
{
    alert "You're a man";
}
else if  ( lookup= "female" )
{
    alert "You're a woman";
}

But now I get ID from lookup field, should I need to search data using ID from another form like this ?

var = form[ID=lookup];

if (  var.sex = "male" )
{
    alert "You're a man";
}
else if  ( var.sex = "female" )
{
    alert "You're a woman";
}


Is there any way to get it  convenient?
Looking forward to your reply.