Good time of day!
There is a form, with 1 checkbox, 1 label, 1 input [text] in this order, and all by 3 (the text is hidden and depends on whether the checkbox is selected or not).
With the help of .each through, but I can’t choose the right input, either all of them or the one that is .eq() via .eq() ;
On codepen.io HTML form and script. Please help me figure it out.
jQuery(function(){ jQuery('form :checkbox').click(function(){ jQuery(this).each(function(index, element){ if (jQuery(this).prop('checked')){ jQuery('input:text').show() } else { jQuery('input:text').hide() } }); }); });