• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

HELP with if statement and null varaibles?!?

Hi,  as you can see when you go to my page it alerts two variables as null

http://www.cs.iupui.edu/~tleithof/n300/final.html

So I can't figure out if its reading the variables as null why is my if statement not working properly?
Since they both are null then the else should be what runs:

      
if((db.username != "null") && (db.password != "null")) {
		$("ul.home").append('<li class="ui-btn ui-btn-icon-right ui-li ui-btn-up-c" role="option" tabindex="-1" data-theme="c"><div class="ui-btn-inner"><div class="ui-btn-text"><a class="ui-link-inherit" href="#account">View Account</a></div><span class="ui-icon ui-icon-arrow-r"></span></div></li>');
	}
	else {
		$("ul.home").append('<li class="ui-btn ui-btn-up-c ui-btn-icon-right ui-li" role="option" tabindex="-1" data-theme="c"><div class="ui-btn-inner"><div class="ui-btn-text"><a class="ui-link-inherit" href="#signup">Sign Up</a></div><span class="ui-icon ui-icon-arrow-r"></span></div></li>');		
	}

Open in new window


But its not, its still passing the test (the first if) and showing the wrong option!  How do I get my if statement to work properly?? (read the null values)
0
FairyBusiness
Asked:
FairyBusiness
1 Solution
 
leakim971PluritechnicianCommented:
remove the quotes around null :

if((db.username != null) && (db.password != null)) {
0
 
FairyBusinessAuthor Commented:
thanks!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now