Js file is not executed on site made with Drupal7

0

Simple problem. I execute this code

$(document).ready(function () {

    $("form#user_register_form").submit(function (event) {
        event.preventDefault();
        alert("Submit prevented");
    });

});

In a javascript file for a site made in Drupal 7 and it does not work, the alert is not shown when sending the form.

I already made sure that the js file was included.

The HTML of the form is automatically generated by Drupal and I made sure that its id is user-register-form and that the button is of type submit and that it is inside the tags of the form.

    
asked by Rory 05.07.2017 в 17:06
source

0 answers