8

I need to change the form action URL depending on the body class of the page. So far I have

$('document').ready(function () {
 if ($('body').hasClass('hosting')) {
      $('#quoteForm').attr('action', 'hostingURL');
      }
});

and that works perfectly. But I need to expand it to include more body classes. I tried

$('document').ready(function () {
 if ($('body').hasClass('hosting')) {
      $('#quoteForm').attr('action', 'hostingURL');
      }
 elseif ($('body').hasClass('workspace')) {
      $('#quoteForm').attr('action', 'workspaceURL');
      }
 else{}
});

but it isn't working. Any suggestions appreciated.

Molly Campbell
  • 339
  • 2
  • 6
  • 15

1 Answers1

5

add white space in elseif like else if

mattn
  • 7,571
  • 30
  • 54