Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click Function For Element inside Modal Generates Error #518

Open
oudin opened this issue Jun 15, 2023 · 1 comment
Open

Click Function For Element inside Modal Generates Error #518

oudin opened this issue Jun 15, 2023 · 1 comment

Comments

@oudin
Copy link

oudin commented Jun 15, 2023

Hi

The following error is generated.

Uncaught TypeError: e.target.parentNode is null
    value /js/micromodal.min.js?ver=2.0:1
    value /js/micromodal.min.js?ver=2.0:1
    value /js/micromodal.min.js?ver=2.0:1
    value /js/micromodal.min.js?ver=2.0:1
    value /js/micromodal.min.js?ver=2.0:1
    value /js/micromodal.min.js?ver=2.0:1
    o /js/micromodal.min.js?ver=2.0:1
    init /js/micromodal.min.js?ver=2.0:1
    <anonymous> /js/main.js?ver=2.0:3
    jQuery 13
        e
        t
        setTimeout handler*Deferred/then/l/<
        c
        fireWith
        fire
        c
        fireWith
        ready
        $
        EventListener.handleEvent*
        <anonymous>
        <anonymous>
micromodal.min.js:1:4590
    value /js/micromodal.min.js?ver=2.0:1
    (Async: EventListener.handleEvent)
    value /js/micromodal.min.js?ver=2.0:1
    value /js/micromodal.min.js?ver=2.0:1
    value /js/micromodal.min.js?ver=2.0:1
    (Async: EventListener.handleEvent)
    value /js/micromodal.min.js?ver=2.0:1
    forEach self-hosted:203
    value /js/micromodal.min.js?ver=2.0:1
    o /js/micromodal.min.js?ver=2.0:1
    init /js/micromodal.min.js?ver=2.0:1
    <anonymous> /js/main.js?ver=2.0:3
    jQuery 13
        e
        t
        (Async: setTimeout handler)
    l
        c
        fireWith
        fire
        c
        fireWith
        ready
        $
        (Async: EventListener.handleEvent)
    <anonymous>
        <anonymous>
        <anonymous>

When using the following:

 jQuery('.modal').on('click', '.show-more', function() {
      var $showMore = jQuery(this);
     $showMore.text($showMore.text() === 'Show more' ? 'Show less' : 'Show more');
});

I'm attempting to have an element inside the modal that is clickable. However, an error is generated.

How can this be fixed?

@heyflo
Copy link

heyflo commented Aug 18, 2023

This sounds like a markup error, can you provide your html? Or even better a testable demo 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants