This seems like it should be trivial for JQuery to do, but this function is hiding the whole form... can someone point me in the right direction?
$('form')
        .children()
        .filter(function(){
            return $(this).data('show', 'pro')
        })
        .show();
$('form')
         .children()
         .filter(function(){
             return $(this).data('show', 'home')
         })
         .hide();
                You're passing 2 arguments to the data method, thereby setting it instead of retrieving the old value.
Use this instead:
$('form')
        .children()
        .filter(function(){
            return $(this).data('show') === 'pro';
        })
        .show();
$('form')
         .children()
         .filter(function(){
             return $(this).data('show') === 'home';
         })
         .hide();
You could also cache your selector for performance (or use end).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With