I am working on a larger project and came up with an idea, that I can’t seem to get working using jquery. Client has web form. A dropdown field is on the form, that will make certain sections/fieidset display and disappear upon selection. I got that going, but then the client wants to have certain fields within those sections display or not based on the type selected from the dropdown.
My idea – I want to hide all the fields within a section is there a way to say hide everything in this section except.
so for example:
<fieldset name="Group1" id="sectionOne">
<legend>Section 1</legend>
<input id="txt_123" type="text" />
<input id="txt_124" type="text" />
<input id="txt_125" type="text" />
<input id="txt_125" type="text" />
<input id="txt_126" type="text" />
</fieldset>
</body>
if i want to say hide everything in #sectionOne. Then later I want to to say hide everything in #sectionOne except….
remember I will have any number of sections with any number of fields, so I want a shorter way than just lines of $(#txt_123).hide();/$(#txt_124).show();
I just really want a clean way of say hide everything in this section except……
You can do,
About except option,
I think its better to select which elements to hide by applying a common class to all the elements that you want to hide.