0

When I check a checkbox

<form action="">
<input type="checkbox" id=“checkbox” name="area" value="storage">     
  Storage
</form>

I want to show and when I uncheck it I want it to be hidden!

I have the following as a start:

$('#checkbox').click(function(){
if ($('#checkbox').attr('checked')) {
    /* NOT SURE WHAT TO DO HERE */
}

})

Drostan
  • 1,809
  • 3
  • 16
  • 22
  • `$('#something').show()` and `$('#something').hide()` – roberrrt-s Nov 28 '16 at 14:53
  • Or simpler than the duplicate: `$("#checkbox).click(function() { $("#something").toggle(this.checked) });` – mplungjan Nov 28 '16 at 14:56
  • I tried the above and created a fiddle https://jsfiddle.net/jnoweb/c1khz1cs/ but this what I've tried doesn't work. Any ideas? – Drostan Nov 28 '16 at 15:17
  • Several errors. No jQuery selected in the jsfiddle. Wrong ID used to assign checkbox event. Storage visible on load https://jsfiddle.net/mplungjan/4o6x5atk/ – mplungjan Nov 28 '16 at 15:21

0 Answers0