我需要根据页面的主体类更改表单操作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)
但它不起作用.任何建议赞赏.
| 归档时间: |
|
| 查看次数: |
19060 次 |
| 最近记录: |