I need help with my code. I’m trying to find a way to change the text on a button. It has to be in a safe mode as it’s the only way JS code can be executed on WordPress on the back-end “Admin”.
Here’s the PHP code that’s in the block:
<div id="click_show" class="acf-field acf-field-button-group acf-field-5ffec954d28f0" data-name="button_click" data-type="button_group" data-key="field_5ffec954d28f0" data-conditions="[[{"field":"field_5f8bec0f9f45d","operator":"!=empty"}]]">
<div class="acf-input">
<div class="acf-button-group"><label class="selected">Show details</label></div>
</div>
</div>
And what I’m trying to change text in the <label> from ‘hide details’ to ‘show details’
My JS code:
jQuery(document).ready(function ($) {
$(document).on("change", "#click_show", function() {
$("#click_show .acf-input .acf-button-group label.selected").text("Hide details 5");
});
});