当点击模态 link 时,出现 "b.preventDefault is not a function"
When click on modal link, "b.preventDefault is not a function" appears
我正在使用 haml 格式处理 Rails,我有一个 table,它在最后一列中有一个启动模式的按钮 (link):
= link_to('#', 'data-toggle' => 'modal', 'data-target' => '#team_modal', 'data-project' => project.id) do %span {
class: 'glyphicon glyphicon-tasks',
'aria-hidden' => 'true',
'aria-hidden' => 'true',
'data-toggle' => "tooltip",
'title' => 'Team',
'data-project' => project.id
}
当我点击它时,出现了模态,然后控制台也出现了以下错误:
Uncaught TypeError: b.preventDefault is not a function
b.hide @ bootstrap.min.js?body=1:7
b.toggle @ bootstrap.min.js?body=1:7
(anonymous function) @ bootstrap.min.js?body=1:7
jQuery.extend.each @ jquery.js?body=1:612
jQuery.fn.jQuery.each @ jquery.js?body=1:242
a.fn.modal @ bootstrap.min.js?body=1:7
(anonymous function) @ bootstrap.min.js?body=1:7
jQuery.event.dispatch @ jquery.js?body=1:3059
jQuery.event.add.elemData.handle.eventHandle @ jquery.js?body=1:2677
我该如何解决这个问题?
经过多次尝试,我终于删除了重复项,例如:
config.assets.precompile << "redesign/bootstrap.js
除此之外,我删除了纯脚本并保留了最小脚本,给定:
config.assets.precompile << "redesign/bootstrap.css"
config.assets.precompile << "redesign/bootstrap.min.css"
config.assets.precompile << "redesign/bootstrap.js"
config.assets.precompile << "redesign/bootstrap.min.js"
拥有这个:
config.assets.precompile << "redesign/bootstrap.min.css"
config.assets.precompile << "redesign/bootstrap.min.js"
注意:我不知道这是做什么的,但它确实有效。如果有人知道为什么保留最小脚本错误消失,请评论它。
我正在使用 haml 格式处理 Rails,我有一个 table,它在最后一列中有一个启动模式的按钮 (link):
= link_to('#', 'data-toggle' => 'modal', 'data-target' => '#team_modal', 'data-project' => project.id) do %span {
class: 'glyphicon glyphicon-tasks',
'aria-hidden' => 'true',
'aria-hidden' => 'true',
'data-toggle' => "tooltip",
'title' => 'Team',
'data-project' => project.id
}
当我点击它时,出现了模态,然后控制台也出现了以下错误:
Uncaught TypeError: b.preventDefault is not a function
b.hide @ bootstrap.min.js?body=1:7
b.toggle @ bootstrap.min.js?body=1:7
(anonymous function) @ bootstrap.min.js?body=1:7
jQuery.extend.each @ jquery.js?body=1:612
jQuery.fn.jQuery.each @ jquery.js?body=1:242
a.fn.modal @ bootstrap.min.js?body=1:7
(anonymous function) @ bootstrap.min.js?body=1:7
jQuery.event.dispatch @ jquery.js?body=1:3059
jQuery.event.add.elemData.handle.eventHandle @ jquery.js?body=1:2677
我该如何解决这个问题?
经过多次尝试,我终于删除了重复项,例如:
config.assets.precompile << "redesign/bootstrap.js
除此之外,我删除了纯脚本并保留了最小脚本,给定:
config.assets.precompile << "redesign/bootstrap.css"
config.assets.precompile << "redesign/bootstrap.min.css"
config.assets.precompile << "redesign/bootstrap.js"
config.assets.precompile << "redesign/bootstrap.min.js"
拥有这个:
config.assets.precompile << "redesign/bootstrap.min.css"
config.assets.precompile << "redesign/bootstrap.min.js"
注意:我不知道这是做什么的,但它确实有效。如果有人知道为什么保留最小脚本错误消失,请评论它。