Add remove select option jquery

Posted: PaulS Date: 02.06.2017

I'm working with Wordpress and I've written a plugin which loads a jQuery source file. My Website has a dropdown list and the HTML code looks like this:.

So it the select tag doesn't have an id and I am not allowed add an id because it is dynamically generated. Thus the only way I can select it is by class name.

javascript - Removing an item from a select box - Stack Overflow

OK it seems like I am using jQuery in noConflict mode and I tried the suggestion in this post Why isn't my jQuery. By posting your answer, you agree to the privacy policy and terms of service.

wordpress - How to remove select options and add new options with jQuery by class name - Stack Overflow

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. Stack Overflow is a community of 7.

Join them; it only takes a minute: How to remove select options and add new options with jQuery by class name Ask Question. My Website has a dropdown list and the HTML code looks like this: Now I want remove all the options in the dropdown box and insert other options into it.

add remove select option jquery

This is what I've tried but it doesn't work: The most obviously visible problem with your code is that your selector, ".

From your answer, it's clear that wasn't the only problem, though. Try with this if you want to update as per your code: Assuming you only have 1 select with a name attribute of 'min' Diego Polido Santana 1, 6 Now this code works: Thank you for all your help!

.add() | jQuery API Documentation

JG Estevez 2 6 Sign up or log in StackExchange. Sign up using Facebook.

Sign up using Email and Password. Post as a guest Name. Stack Overflow works best with JavaScript enabled.

add remove select option jquery

MathOverflow Mathematics Cross Validated stats Theoretical Computer Science Physics Chemistry Biology Computer Science Philosophy more 3. Meta Stack Exchange Stack Apps Area 51 Stack Overflow Talent.

Rating 4,2 stars - 696 reviews
inserted by FC2 system