Moonchild71
New Member
Im working on a wordpress plugin. In the admin panel, I have a fieldset and a checkbox. I would like to toggle the fieldset between disabled/enabled by checking/unchecking the checkbox.Here is what I have so far, but it doesn't seem to work.HTML\[code\]<!-- This is the checkbox --><label> <input class="checkbox" type="checkbox" onchange="toggleDisable(this);" id="check"/> enable</label><!-- This is the field set --><fieldset id="field_set"> <legend>Field-Set</legend> <label for="sel">selectBox</label> <select id="sel"> <option value="http://stackoverflow.com/questions/14473233/posts">Posts</option> <option value="http://stackoverflow.com/questions/14473233/terms">Terms</option> </select> <label for="1">input</label> <input type="text" value="http://stackoverflow.com/questions/14473233/text" id="1" /> <label for="2">input</label> <input type="text" value="http://stackoverflow.com/questions/14473233/text" id="2" /></fieldset>\[/code\]JavaScript\[code\]function toggleDisable(checkbox) { var toggle = document.getElementById("field_set"); checkbox.checked ? toggle.disabled = false : toggle.disabled = true;}\[/code\]The event is not being fired, and nothing happens with the fieldset.
Oh, and here is a Fiddle.
Oh, and here is a Fiddle.