Support » Plugins » Hacks » Contact Form 7 – jQuery checkbox

  • $(document).ready(function() {
    
            //Hide the field initially
            $("#hide3").hide(); 
    
            //Show the text field only when the third option is chosen - this doesn't
            $('#nieuwsbrief').change(function() {
                    if ($("#nieuwsbrief").val() == "Ja") {
                            $("#hide3").show();
                    }
                    else {
                            $("#hide3").hide();
                    }
            });
    
    });
    [checkbox* nieuwsbrief id:nieuwsbrief "Ja"]
    
    <div class="hide" id="hide3">
    [email email]
    </div>

    How to get this working? With select it works perfectly..

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I think you need a different event trigger, such as ‘click’. Unlike the select element, the ‘change’ event does not fire until the checkbox loses focus, which is not the expected behavior in this case.

Viewing 1 replies (of 1 total)
  • The topic ‘Contact Form 7 – jQuery checkbox’ is closed to new replies.