使用jquery更改表单操作URL

Mol*_*ell 8 forms jquery

我需要根据页面的主体类更改表单操作URL.到目前为止我有

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

而且效果很好.但是我需要扩展它以包含更多的身体类.我试过了

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

但它不起作用.任何建议赞赏.

mat*_*ttn 5

在添加空白elseifelse if