If:checked

Hi all,

I have a rule that hides an error message if a checkbox has been clicked. I’d like to take it one step further and show the error again if the checkbox is unchecked.

From my Google hunting, it looks like it will use :checked but I can’t seem to get it working!

Here’s what I have.

$(document).ready(function{
	$("input[type=checkbox]").click(   
    function() {   
	   $(this).parent('label').children('span.error').hide(); 
    }   
);
});

Many thanks

You don’t need :checked here. Just replace .hide() with .toggle() :slight_smile:

Haha easy as that?! Works great, thanks : )