question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Collapse doesn't work if id contains dot

See original GitHub issue

Hello

Collapse doesn’t work if id contains dot.

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
    <title>Hello, world!</title>
</head>
<body>

<div class="accordion" id="accordion">
    <div class="card">
        <div class="card-header">
            <h5 class="mb-0">
                <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapse.One">
                    Collapsible Group Item #1
                </button>
            </h5>
        </div>

        <div id="collapse.One" class="collapse show" data-parent="#accordion">
            <div class="card-body">
                xxx
            </div>
        </div>
    </div>

    <div class="card">
        <div class="card-header">
            <h5 class="mb-0">
                <button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapse.Two">
                    Collapsible Group Item #2
                </button>
            </h5>
        </div>
        <div id="collapse.Two" class="collapse" data-parent="#accordion">
            <div class="card-body">
                yyy
            </div>
        </div>
    </div>
</div>

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
</body>
</html>

Please fix the bug. Thank you.

– Mykola

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Johann-Scommented, May 15, 2018

You have to escape your selector that’s what jQuery said by :

image

and it’ll be fine 😉

Everything passed in our data-target attribute is passed to jQuery as a selector

0reactions
Johann-Scommented, May 15, 2018

We made that in a previous PR but finally we reverted that because it’s too hard to detect correctly special selectors.

See:

We added a quick note in our documentation see: https://getbootstrap.com/docs/4.1/getting-started/javascript/#escaping-selectors

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't show the element when its class or id contains dots
Class is given. Then I put it in array like info['id'] and it is equal dfv.png . Then I need to make it...
Read more >
Collapse and other navigation options are now Dots
Hi. Turned on my computer this morning and I now have dots instead of the normal +- collapse and x buttons.
Read more >
MVD Self-Service Tag Kiosk - FAQ
MVD Self-Service Tag Kiosk - FAQ ... What can I do at a kiosk? You can renew eligible vehicle tags and pay insurance...
Read more >
Colony Collapse Disorder | US EPA
The number of hives that do not survive over the winter months – the overall indicator for bee health – has maintained an...
Read more >
Frequently Asked Questions | Republic Services
You can verify employment by contacting the Work Number via phone: ... What if I have questions about my bill or think there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found