0

I use Jquery-UI and accordingly the selectmenu-widget in my project. Can I disable the widget for a specific element, so that the select look and functionality returns to native?

I tried solutions mentioned in Jquery disable theming for a specific element but without success. data-role: none is not doing any change, and I can't simply remove ui-classes because the widget creates a whole new element which acts like a proxy for the select and so the select itself does not have any classes.

Any help would be appreciated.

3
  • Will need a Minimal, Reproducible Example: stackoverflow.com/help/minimal-reproducible-example Commented Jun 3, 2020 at 16:56
  • Also please review: api.jqueryui.com/selectmenu/#method-disable Commented Jun 3, 2020 at 17:23
  • @Twisty the disable/destroy method is one solution. It didn't work for me at first, since the inital element got hidden by jquery-ui and I had to show() it manually again. Commented Jun 4, 2020 at 8:29

1 Answer 1

0

I solved it by manually destroying the selectmenu-element and displaying the initial element again at documentReady().

I would be glad to hear about a better solution since this one is hacky and involves problems, e.g. at responsiveness if the element should be displayed just at a specific screen size, you have to handle it again manually in your function where you render the initial element back.

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

1 Comment

If you want a better solution, you will need to provide a proper example. I suspect a selector can more acutely select the elements you want and avoid the one you do not want when you initialize SelectMenu.

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.