How to make all selected options enabled in select element using jQuery
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')No need to iterate.
Use selector
:disabledto select all disabledUse
.prop()to set to enabled
Connect with KoderSolution 🚀
Master modern software engineering, scalable architectures, and advanced backend systems.
Read more architectural deep-dives, systems tutorials, and engineering guides on kodersolution.com.
Subscribe to @kodersolution for concise, animated system design breakdowns and technical shorts.
Follow our official page for daily development tips, architecture discussions, and community updates.
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.