You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The data-bs-target css selector doesn't works with complex selector like "#myDiv:not(.show)".
I have checked it with the dropdown and collapse components.
It works in version 5.2, but not 5.3.3
This is useful if you want a button to open a collapse, without being able to close it when you click again.
Edit: It works using class, but not id, for example: <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target=".myDiv:not(.show)">Open</button>
<div class="collapse myDiv">Hidden message</div>
chatelain
changed the title
data-bs-target doesn't support complex css selector
data-bs-target doesn't support complex css selector with id
Oct 31, 2024
Prerequisites
Describe the issue
The data-bs-target css selector doesn't works with complex selector like "#myDiv:not(.show)".
I have checked it with the dropdown and collapse components.
It works in version 5.2, but not 5.3.3
This is useful if you want a button to open a collapse, without being able to close it when you click again.
Reduced test cases
<button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#myDiv:not(.show)">Open</button>
<div id="myDiv" class="collapse">Hidden message</div>
If you rename the div id to
<div id="myDiv:not(.show)"></div>
(what is a wrong thing to do), it toggle the collapse again.bootstrap_example.txt
What operating system(s) are you seeing the problem on?
Windows
What browser(s) are you seeing the problem on?
Chrome
What version of Bootstrap are you using?
5.3.3
The text was updated successfully, but these errors were encountered: