2

I have an html select DOM object by simply coding the raw html <select ...

I then use javascript and jQuery to change that select into a 'multiselect' object by using code like this...

$("#myselectid").multiselect();

And later on some event, I am trying to hide that multiselect with jQuery code like this...

$("#myselectid").hide()

But that does not work. Does anyone know why?

5
  • Can you reproduce this issue on jsfiddle? or even at least paste your full code. Commented Mar 14, 2014 at 19:32
  • If you did in fact get the selector right, and that's just a typo, I'm guessing the plugin creates an unordered list, or some other element, instead of the select element and you're not targeting that element. Commented Mar 14, 2014 at 19:35
  • What plugin are you using? Commented Mar 14, 2014 at 19:41
  • Give this a shot? - $("ui-multiselect").hide(); $("ui-multiselect-menu").hide(); Commented Mar 14, 2014 at 19:49
  • Just wrap it in a div e.g. mydiv and then you can use $("#mydiv").hide(); Commented Mar 14, 2014 at 20:29

1 Answer 1

4

Multiselect hides the original select and then it creates a button with the select behavior

Try

$("#myselectid").next().hide()

And it will hide that select that is created

Take a look at this page

if you do a

$("select:eq(0)")

That element is already hide but the one that you see is the next one (a button) try:

$("select:eq(0)").next()

You need to hide this one, that is the one created by multiselect

Sign up to request clarification or add additional context in comments.

3 Comments

Ahm you don't have the next i don't see it o.o
Thank you! That was the issue!
Yw I'm glad I could help you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.