Posted By

jimmysessions on 10/21/08


Tagged

select jquery reset field


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

Zver
obi
digitalbart
agdm


jquery reset select field


 / Published in: JavaScript
 

  1. $('#field').find('option:first').attr('selected', 'selected').parent('select');

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: Throlkim on May 24, 2009

Perfect, just what I was looking for. Thanks =)

Posted By: obi on September 25, 2009

+1, just what I needed

Posted By: Treffynnon on November 26, 2009

This is really quite a convoluted example. I would use this:

 var field = $('#field');
 field.val($('option:first', field).val());

The above example is taken from my article on manipulating select lists with jQuery: jQuery Using and Manipulating Select Lists

Posted By: jimmysessions on December 8, 2010

I love seeing code made simpler, thanks @Treffynnon

You need to login to post a comment.