Support » Plugin: WooCommerce » Remember me ticked ?

  • Hi

    I have ” remember me ticked ” on login for wordpress with this code:

    <?php
     
    function login_checked_remember_me() {
        add_filter( 'login_footer', 'rememberme_checked' );
    }
    add_action( 'init', 'login_checked_remember_me' );
     
    function rememberme_checked() {
    	echo "<script>document.getElementById('rememberme').checked = true;</script>";
    }
    ?>

    How to achieve the same with woocomerce login?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    <script>document.getElementById('rememberme').checked = true;</script>

    That’s looking for an element with an ID of “rememberme”. Out of the box, the WooCommerce login form doesn’t use that element ID. This means you’d need to adjust your javascript to look for the for=rememberme attribute instead.

    Truth be told, this is easier in jQuery. If you’d like to stick with pure Javascript though, you’d first need to create a function that allows you to use something like getElementByAttr(). There’s a good example of that in action at http://stackoverflow.com/questions/6267816/getting-element-by-a-custom-attribute-using-javascript

    Thread Starter mikehaceman

    (@mikehaceman)

    hi @riaan,

    Thanks for quick answer. I have used:

    <script>document.getElementById(‘for=rememberme’).checked = true;</script>

    If thats what you meant … it didnt work. Im not a coder so writing code from zero wont happen for me. If you can provide full answer with full solution that would be great. As for the way, java or jquery – i dont have preferences. I just want to make it work 🙂

    Thread Starter mikehaceman

    (@mikehaceman)

    any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remember me ticked ?’ is closed to new replies.