我尝试使用以下JavaScript代码在3分钟后触发按钮的点击事件
setTimeout(function(){$(‘._my_save_button’).trigger(‘click’)},180000);
在chrome控制台中运行时,上述代码会引发错误
Uncaught SyntaxError: Invalid or unexpected token
答案 0 :(得分:3)
我们需要在您的标识符周围加上引号。
res.partner
答案 1 :(得分:0)
我认为您只缺少正确的CSS选择器。
在let result = [
{
name: 'dashboard',
path: '/dashboard',
id: 'my-dashboard-id',
someotherprop: someothervalue
...
},
{
name: 'dashboard.settings',
path: '/dashboard/settings',
id: 'my-settings-id',
someotherprop: someothervalue
...
},
{
name: 'dashboard.settings.user',
path: '/dashboard/settings/user',
id: 'my-user-id',
someotherprop: someothervalue
...
},
{
name: 'dashboard.settings.email',
path: '/dashboard/settings/email',
id: 'my-email-id',
someotherprop: someothervalue
...
},
{
name: 'dashboard.settings.email.template',
path: '/dashboard/settings/email/template',
id: 'my-template-id',
someotherprop: someothervalue
...
},
{
name: 'dashboard.settings.email.template.error',
path: '/dashboard/settings/email/template.error',
id: 'my-error-id',
someotherprop: someothervalue
...
},
.....
]
的情况下应为"#_my_save_button"
或id="_my_save_button"
(如果是"._my_save_button"
:
class="_my_save_button"