dstreet / dependsOn

a jQuery plugin for handling form field dependencies
http://dstreet.github.com/dependsOn
MIT License
106 stars 32 forks source link

Issues with form loaded via AJAX #37

Open ownede opened 7 years ago

ownede commented 7 years ago

Hello,

In my app, I'm showing a modal window, which a form, that is being loaded via AJAX. It's HTML is added using $().html() jQuery method.

Unfortunately, even when adding dependencies after adding HTML form content, as seen below:

$('.ajax-content', modal).html(response);
initProductDependencies();

...

function initProductDependencies()
{
        $('#something').dependsOn({
            '#otherthing': {
                checked: true
            }
        });
}

I got an error message saying:

Uncaught TypeError: Cannot read property 'nodeName' of undefined

Any workarounds?

dstreet commented 7 years ago

@ownede could you provide for of your code? Its hard to diagnose without more context.