The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to call custom jQuery functions via the use of a WordPress filter hook

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #144349

    Note: I can’t seem to use greater and less than symbols in my code below.


    So I have some jQuery functions that adjust my column layout on window load and window resize.
    They are inside a file called bp-columns.js that looks like this:

    jQuery(window).load(function () {

    jQuery(window).resize( function () {

    function columnHeight() {
    // code here to calculate and adjust column height

    function columnWidth() {
    // code here to calculate and adjust column width

    bp-columns.js is enqueued in my functions.php like so:

    function my_scripts() {
    wp_enqueue_script( ‘bp-columns’, get_stylesheet_directory_uri() . ‘/js/bp-columns.js’, array( ‘jquery’ ) );
    add_action( ‘wp_enqueue_scripts’, ‘my_scripts’ );

    All the above code is working fine.

    Now… I have a page that has a Gravity Form on it and I need to recalulate my column layout when form validation occurs to account for the extra height in the content created by validation messages. There is a filter hook for form validation with Gravity Forms.

    The following code in my functions.php prints a message to the console successfully when the form is validated.

    function custom_validation($validation_result){

    return $validation_result;
    add_filter(‘gform_validation’, ‘custom_validation’);

    *** My question is:

    How do I call the functions columnWidth() and columnHeight() whenever form validation occurs?

    Any help much appreciated.

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.