You can try to loop through the fields with the following code; however, if the fields have a hidden attribute, they will be hidden. No need to apply .show to elements that will already be displayed.
Scroll through all the visible fields:
$("#Form1 :input").not(':button, :hidden').each(function() {
Update
// show form, clear hidden values $(".dropdown").on('change', function() { if ($(this).val() == "Show all fields") { $("#Form1").show(); $("#Form1 :input").is(':hidden').each(function() { $(this).val(''); }); } });
Update 2:
$(".dropdown").on('change', function() { if ($(this).val() == "Show all fields") { $("#Form1").show(); $('#Form1 *').filter(':input').each(function() {(...)}); } });
source share