Jquery remove all select options except first

Posted: nokynku Date of post: 05.07.2017

My problem is my list is dynamic sometimes I have 3,5,7, Learned from this post.

javascript - JQuery - Remove all option from Selectbox except for first and selected - Stack Overflow

By posting your answer, you agree to the privacy policy and terms of service. Stack Overflow Questions Developer Jobs Documentation beta Tags Users. Sign up or log in to customize your list.

Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us.

Log In Sign Up. Join the Stack Overflow Community.

jquery remove all elements except for first one - Stack Overflow

Stack Overflow is a community of 7. Join them; it only takes a minute: I have a select that contain this values: My need of this code deals more with excluding a file from a concatenation and minification process headed by stream.

Arun P Johny k 39 If the option is always the last one, I hope this JavaScript code can help you: Cedric 50 1 7. Sign up or log in StackExchange.

Sign up using Facebook. Sign up using Email and Password.

jQuery Tutorials: AJAX Load Content No Page Refresh

Post as a guest Name. Stack Overflow works best with JavaScript enabled.

javascript - How do you remove all the options of a select box and then add one option and select it with jQuery? - Stack Overflow

Fiddle share improve this answer. MathOverflow Mathematics Cross Validated stats Theoretical Computer Science Physics Chemistry Biology Computer Science Philosophy more 3.

jquery remove all select options except first

Meta Stack Exchange Stack Apps Area 51 Stack Overflow Talent.

Rating 4,1 stars - 555 reviews
inserted by FC2 system