admin管理员组

文章数量:1122832

I'm using this code to limit max number of characters to a determined field... is it possible to force UPPERCASE?

Here's what I'm using:

add_action("wp_footer", "cod_set_max_length");

function cod_set_max_length(){
    if( !is_checkout())
    return;
    ?>
    <script>
    jQuery(document).ready(function($){
        $("#cracha_empresa").attr('maxlength','33');
        $("#cracha_primeironome").attr('maxlength','12');
        $("#cracha_sobrenome").attr('maxlength','26');
        // more fields
    });
    </script>
    <?php
}

I'm using this code to limit max number of characters to a determined field... is it possible to force UPPERCASE?

Here's what I'm using:

add_action("wp_footer", "cod_set_max_length");

function cod_set_max_length(){
    if( !is_checkout())
    return;
    ?>
    <script>
    jQuery(document).ready(function($){
        $("#cracha_empresa").attr('maxlength','33');
        $("#cracha_primeironome").attr('maxlength','12');
        $("#cracha_sobrenome").attr('maxlength','26');
        // more fields
    });
    </script>
    <?php
}
Share Improve this question edited May 29, 2019 at 17:49 LoicTheAztec 3,38117 silver badges24 bronze badges asked May 29, 2019 at 14:39 Daniel GonçalvesDaniel Gonçalves 111 bronze badge 0
Add a comment  | 

1 Answer 1

Reset to default 0

You could do a couple things.

Use JS toUpperCase() to transform the text.

var upper = text.toUpperCase();

Or just use CSS to do it.

#yourID {
    text-transform: uppercase;
}

本文标签: jqueryForce uppercase on some WooCommerce checkout fields input