Wednesday 15 September 2010

jquery - Show all select box options that don't contain the value hello_ -


So I want to be able to hide all the options and then only show people who do not include hello_ their value includes Hello_by , Hello_Hello etc. Whoever starts with Hello _

is what I have done so far:

  jQuery ) .ready (function () {jQuery ("#metakeyselect" option). Hide (); jQuery ("#metakeyselect" gt; option [/]] What's here? / /] ")   

How do I show everything, but how do I show values ​​along with Hello?

You can "hide" those people whose value is used by Hello _ .

Tell that correctly Or you can not remove the option elements from all browsers (see also this). But you can remove them:

  var hidden_options = jQuery ("#metakeyselect" option) [Value = = hello_] "). Remove ();   

Or disable them:

  jQuery ("#metakeyselect> option [value ^ = hello _]"). Prop ('disabled', true);   

Depends on what you want to do with them.

No comments:

Post a Comment