5

I'm referring this issue to an answered thread: disable jquery-chosen dropdown

This actually did not work for me when I tried it. And neither did that Fiddle link demo worked for me (Firefox v22). What am I mssing here? I basically just need to disable the jquery-chosen UI element when the real original select element is disabled. Is there another way of doing this?

Thanks.

Community
  • 1
  • 1
Niner
  • 2,074
  • 6
  • 37
  • 47

1 Answers1

7

that answer doesn't work with the last version.. they deprecated liszt:updated in favor of chosen:updated

something like this works

$(".chosen-select").prop('disabled', true).trigger("chosen:updated")

here's a JSFiddle

Update

  • Changing answer to use prop instead of attr
Orlando
  • 9,374
  • 3
  • 56
  • 53
  • Correct me if I'm wrong, but I'm pretty sure you should use .prop() instead of .attr() http://api.jquery.com/prop/ – Robin Neal Jun 11 '14 at 14:19
  • @RobinNeal, i tested both, `attr` & `prop` worked for me – Zeeshan May 26 '15 at 13:53
  • 1
    @Zeeshan It's more a matter of proper practices rather than what works. Please refer to the section about Prop vs Attr in the link I posted in my previous comment. – Robin Neal Jun 04 '15 at 13:39