作者:mobiledu2502855037 | 来源:互联网 | 2023-09-11 11:24
父标签添加toggle="buttons" 属性之后,子元素A标签的默认行为会不阻止。一下是DOM结构
点击A标签是不会有任何反应的。这边不清楚boostrap阻止A标签的目的是什么,所以看了一下事件绑定的源码。大概是这样的!
1 2 3 4 5 6 7 8 9
| if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
// Prevent double click on radios, and the double selections (so cancellation) on checkboxes
e.preventDefault()
// The target component still receive the focus
if ($btn.is('input,button')) $btn.trigger('focus')
else $btn.find('input:visible,button:visible').first().trigger('focus')
} |
// Prevent double click on radios, and the double selections (so cancellation) on checkboxes
我英语水平不咋地,有道加蒙,这句我理解的意思是 阻止在radios和ckeckbox表单双击,避免双击变成取消选中。
好,到这里我就更蒙逼了,既然是阻止双击,为啥这一句“$(e.target).is('input[type="radio"], input[type="checkbox"]')”还要做一下非运算。思前想后就是想不明白。
论坛里有大神指教一下咯