• Resolved mladenko88

    (@mladenko88)


    Hello,

    i used custom validation example for 4th input ( only numbers ), but would like to show error in style like error messages are shown, can u help me?

    i used this code:

    <?php
    
    add_action(
    
    'wp_footer',
    
    function() {
    
    ?>
    
    <script>
    
    ( function ( $ ) {
    
    $(document).bind('ready ajaxComplete', function() {
    
    var cvalinput = $( '.custom-validate input' ),
    
    regx = /^[0-9]*$/;
    
    $(cvalinput).bind('focusout keyup ',function() {
    
    if ( regx.test( $( this ).val() ) || $( this ).val() === '' ) {
    
    $( this ).parent().parent().find( 'label.forminator-label--validation' ).remove();
    
    } else {
    
    if ( ! $( this ).parent().parent().find( 'label.forminator-label--validation' ).length ) {
    
    $( this ).parent().parent().append( '<label class="forminator-label--validation">Only alphanumeric characters are allowed.</label>' );
    
    }
    
    }
    
    } );
    
    } );
    
    } ( jQuery ) )
    
    </script>
    
    <?php
    
    },
    
    999
    
    );

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change label validation class’ is closed to new replies.