Posted By

wjbrown on 06/26/09


select default jquery reset

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


jQuery reset all select fields

 / Published in: jQuery

Couldn't find a better way to do this, nor could I find it on teh interwebs, so here it is.

  1. // for each select field on the page
  2. $("select").each( function(){
  3. // set its value to its first option
  4. $(this).val( $("#" + $(this).attr("id") + " option:first").val() );
  5. });

Report this snippet  

You need to login to post a comment.