1

I cant seen to find out what Im doing wrong

var newcustomerform = $('#newcustomerform');

//hide new customer form
function hideForm(){
    newcustomerform.hide();
}

$(function(){
hideForm(); //this doesnt work
});

Whats the issue here?

Stanley Ngumo
  • 4,089
  • 8
  • 44
  • 64

1 Answers1

0

You must wait for the DOM to load before trying to point to a DOM element. To do that, put var newcustomerform = $('#newcustomerform'); inside the $(function(){ i.e. just above where you call hideForm()

josephnvu
  • 1,210
  • 1
  • 9
  • 14