How to make all selected options enabled in select element using jQuery

Avatar
T

Tariq Mansoor

Database & Performance Engineer••
7901Views
5mRead
0Reactions

In this article, I am sharing with you, how to enable all disabled selected options in select elements using jquery without iteration.

Without chosen-select

$

(

'.select-product'

).

find

(

"option:disabled"

).

prop

(

"disabled"

,

false

)

If using chosen-select, using 2nd example

$('.select-product').find("option:disabled").prop("disabled",false).trigger('chosen:updated')
  1. No need to iterate.

  2. Use selector :disabled to select all disabled

  3. Use .prop() to set to enabled

Connect with KoderSolution 🚀

Master modern software engineering, scalable architectures, and advanced backend systems.

What's your setup?What's your production setup for this scenario? Have you encountered similar architectural bottlenecks or edge-case gotchas?
Tariq Mansoor
T
Written by•Database & Performance Engineer

Tariq Mansoor

Spends an unhealthy amount of time in EXPLAIN ANALYZE. Fixes slow N+1 queries, indexes table scans, and tunes PostgreSQL/MySQL for high-throughput apps.

React to this article

Recommended Articles

View all articles