Button classes

Support MB Frontend Submission Button classesResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #43564
    YasmineYasmine
    Participant

    I have added some classes to the button:

    [
    'id' => $prefix . 'rs_p6_back_btn',
    'type' => 'button',
    'std' => __( 'Back', 'your-text-domain' ),
    'class' => 'form-nav back-btn rs_p6',
    'columns' => 4,
    'save_field' => false,
    'tab' => 'page_6',
    'attributes' => [
    'data-target' => 'page_5'
    ]
    ],

    But when I use one of my added classes in JS to target this button type it does not work. However if I use the rwmb_button then the code works. It only works with that. But I don't want to have such a broad selector.

    When I inspect my button I do not see my classes: <button type="button" id="rs_p6_back_btn" class="rwmb-button button hide-if-no-js" name="rs_p6_back_btn" data-target="page_5">Next</button>

    Instead I see them as a wrapper <div class="rwmb-field rwmb-button-wrapper form-nav back-btn rs_p6"><div class="rwmb-input"><button type="button" id="rs_p6_back_btn" class="rwmb-button button hide-if-no-js" name="rs_p6_back_btn" data-target="page_5">Next</button></div></div> and I wonder if this is the issue?

    How do I get around this and target the button in JS ?

    #43565
    YasmineYasmine
    Participant

    Can close.

    Worked out that the class goes in attributes, different to the other fields!

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.