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 ?