Skip to content

Uncaught TypeError: $ is not a function #36

@davetbo

Description

@davetbo

Hello,

I just started using Zebra_Forms. I'm using it in Wordpress and I've installed it via composer by adding:

{
	"require": {
	  "stefangabos/zebra_form" : "*"
	}
}

to my composer.json. So far I have just done this test form:

        $this->form = new \Zebra_Form(get_class());
        $this->form->add('label','label_al_setup_street_address', 'al_setup_street_address', 'Street Address: * ');
        $this->form->add('text', 'al_setup_street_address', '');

and rendered it. I see this:
image

So far so good. However, in my console I see this:
image
and this:
image

That part of the javascript code was added by your library. Everywhere I refer to jQuery I actually spell out jQuery. I don't use $.

Also, I included your javascript by doing this:
add_action('admin_enqueue_scripts', array($this, 'generate_styles'));
and then later in the generate_styles function:
wp_enqueue_script('zebra_forms_js', WZ_PLUGIN_URL . 'vendor/stefangabos/zebra_form/public/javascript/zebra_form.js', array('jquery'));
so it should have the required jquery libraries accessible since I listed them as a dependency.

Any advice on how to get this to work? I'd rather not have to edit your javascript directly.

Best,
Dave

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions