hi,
is it possible to make a toggle? i need a classic toggle with a state (toggled or not toggled) for a script.
i tried it with a button but the button has no state.
than ks in advance for your help.
cheers
hi,
is it possible to make a toggle? i need a classic toggle with a state (toggled or not toggled) for a script.
i tried it with a button but the button has no state.
than ks in advance for your help.
cheers
Hello Harald,
On Button element > Customize Tab > ID field: Add btn-toggle
Then to add a state, we will add an class. On Custom JS add this code:
jQuery ( function($) {
$('#btn-toggle').click(function(){
$( this ).toggleClass("active");
if( $( this ).hasClass('active')){
$(this).find('.x-anchor-text-primary').text("SHOW");
}else{
$(this).find('.x-anchor-text-primary').text("HIDE");
}
$("#toggle-content").toggle();
});
} );
You may use the active class to manage the state of the button. toggle-content should be the ID of the element where you want to hide using button click. Please note that, further customization from here would be beyond the scope of our support. Thank you.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.