Black Friday Sale! Get up to $40 off GP Premium!Learn more

[Support request] Put jquery function in a hook but it does'nt work

Home Forums Support Put jquery function in a hook but it does'nt work

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #436773

    Hi folks,
    im just setting up a new site for a real estate agent. On the single views of the objects there is an “object-id” which I want to transmit to a CF7 form. Therefore I’ve added a button in the single view which opens the site with the form. Additonally I’ve added a jquery function in the wp_footer area of the GP-Hooks. But this does’nt seems to work and I’m not a professional coder to get this solved. Is anyone here who might have an idea?

    Please see here for details (single view):

    The orange button on the single view should “transfer” the object_id to the following form and fill it in the input area:

    This is the code I used in the wp_footer hook area:

    let objNr = $('#eckdaten li span.objektnummer').html();

    The orange button is added with the shortcode ultimate plugin like this:
    [su_button url="" target="self" style="default" background="#ff9900" color="#FFFFFF" size="10" wide="no" center="no" radius="auto" class="pull-right right30"]Jetzt Anfrage stellen[/su_button]

    GeneratePress 1.4
    GP Premium 1.5.5
    Lead Developer
    Lead Developer

    Hi there,

    I’m not seeing any orange button? Has it moved?

    That code looks like it should store the HTML inside that span, and then update an input value with the stored HTML.

    Maybe instead of .html(), try .text().


    Hi Tom,

    yes, actually I’ve removed it – just testing. 🙂
    I will try it with .text() and activate the button again.


    No, it’s the same with .text()

    Everything now is described as above right now.

    Thanks for your help so far!


    Lead Developer
    Lead Developer

    Ah, well you need to give the button a class, then do something when the button is clicked:

    jQuery( '.button-class' ).on( 'click', function( e ) {
        // Do stuff when the button is clicked.
    } );
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.