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
  • 3,879
  • 8
  • 35
  • 61

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,108
  • 6
  • 13