简体   繁体   中英

Show / Hide div with input value works on Safari but not Chrome

I'm using the below to show/hide a registration form based on the input value (ie a hidden registration form that you can only access with a password)...

It works fine on Safari, but not on Chrome - any ideas why?

<style>
#regHidden { display: none; }
</style>

<script type="text/javascript">
(function($){
$(document).ready(function() {
                $('#ff_elem576').on('keyup', function(event) {
                        if ($(this).val() == "YANDV") 
                            $('#regHidden').show(),
                            $('#hideReg').hide();
                        else 
                            $('#regHidden').hide(),
                            $('#hideReg').show();
                });
            });
})(jQuery);
</script>

Here's a link to the page in question.

Thanks, Matt

The console is showing some errors on your page. You should correct them. That's probably why it isn't working.

Especially the one that used the sticky function, that's "breaking" the JS of your page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM