Hi again @agusgonzalezs,
You can use the following code snippet as mu-plugin.
add_filter( 'forminator_field_password_markup', 'wpmudev_password_html_render', 10, 2 );
function wpmudev_password_html_render( $html, $field ) {
$pos = strpos( $html, '</div>' );
if ( $pos !== false ) {
$html = substr_replace($html, '<span id="toggle_pwd" class="forminator-description forminator-description-password"> Show/Hide Password </span></div>', $pos, strlen('</div>'));
}
return $html;
}
add_action( 'wp_footer', function(){
global $post;
if( ! $post instanceof WP_Post || ! has_shortcode( $post->post_content, 'forminator_form' ) ) {
return;
}
?>
<style>
#toggle_pwd{
cursor: pointer;
text-align:right;
}
</style>
<script type="text/javascript">
jQuery( document ).ready( function($) {
setTimeout(function() {
$('.forminator-custom-form').trigger('after.load.forminator');
},100);
$(document).on('after.load.forminator', function(event, form_id) {
if ( event.target.id == 'forminator-module-3643' ) {
$("#toggle_pwd").click(function () {
$(this).toggleClass("fa-eye fa-eye-slash");
var type = $(this).hasClass("fa-eye-slash") ? "text" : "password";
$("#password-1 input").attr("type", type);
});
}
});
});
</script>
<?php
},9999);
You will need to replace the form ID from 3643 to their form’s ID here.
if ( event.target.id == 'forminator-module-3643' ) {
Please find more information below on how to use mu-plugins.
https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins
Kind regards,
Zafer