lundi 5 octobre 2015

TypeError: target is null in noUISLider

I am using noUISlider - http://ift.tt/x3H9Pe . When adding the slider nouislider.js via enqueue script in Wordpress i get following javascript error in firebug -

TypeError: target is null

if ( !target.nodeName ) {

Here i how enqueued the script -

wp_register_script('realstate-noui', BRPC_BASE_URL . 'js/nouislider.js');
wp_enqueue_script('realstate-noui');

The code of nouislider.js where error is happening -

function initialize ( target, originalOptions ) {

                if ( !target.nodeName ) {
                        throw new Error('noUiSlider.create requires a single element.');
                }

                // Test the options and create the slider environment;
                var options = testOptions( originalOptions, target ),
                        slider = closure( target, options );

                // Use the public value method to set the start values.
                slider.set(options.start);

                target.noUiSlider = slider;
        }

        // Use an object instead of a function for future expansibility;
        return {
                create: initialize
        };


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire