THis is how i am trying (no firebug errors) to restore each select of my form to its first option value
/* $(this) is the form */
$(this).find('input[type="text"],textarea').val(''); /* This works */
$(this).find("select").each(function(){
$(this).val($(this,"option:first").val()); /* this doesnt do anything */
});
what am i doing wroing?
-edit-
just found out.. this works, why not with the comma?
$(this).val($(this).find("option:first").val());
Just try this:
This will automatically set the first option value as default.
If you use you code you need:
Your
$(this, "option:first")not worked because you code is searching aselectwithin aoption, but it should searchoptionwithinsearch.One format of jquery selector is