mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-28 06:20:15 +02:00
Collapse - preventDefault only on <a> elements not inside the collapsible
element
This commit is contained in:
@@ -361,7 +361,8 @@ const Collapse = (($) => {
|
||||
*/
|
||||
|
||||
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||
if (!/input|textarea/i.test(event.target.tagName)) {
|
||||
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
|
||||
if (event.target.tagName === 'A' && !$.contains(this, event.target)) {
|
||||
event.preventDefault()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user