【发布时间】:2014-02-11 10:24:47
【问题描述】:
我有下面的 jQuery 代码来检测提交事件并触发一些其他的 javascript 代码:
$('form#send-message').on('submit', function(){
console.log('test');
$('body').modalmanager('loading');
});
但这不适用于:
.modal-header
Contact info
%button.close{ :type => 'button', 'data-dismiss' => 'modal', 'aria-hidden' => 'true' }
×
.modal-body
= raw @booth.contact_info
%hr
= simple_form_for(@booth, url: booth_send_message_path, method: :post, html: { id: "send-message" }, remote: true) do |f|
.form-group
%textarea#message.form-control{name: "user[message]", placeholder: "Type your message here..."}
%input{type: "hidden", name: "user[id]", value: "#{current_user.id}"}
.form-actions
%button.btn.btn-warning{:type => 'submit'} Send
= f.error_notification
表单的 id 肯定是匹配的,但似乎什么都没有触发
事件无法正常工作是否有原因?
【问题讨论】:
标签: javascript jquery ruby-on-rails haml