Topic: How to select an dropdown option via javascript?
salmanfazal01 pro asked 6 years ago
How do I dynamically change the option from a select dropdown using javascript or jquery?
My html code:
<select class="mdb-select md-form" id="symbol" searchable="Search here..">
<option value="ABC">ABC</option>
<option value="XYZ">XYZ</option>
<option value="SDA">SDA</option>
</select>
This is what I have tried till now:
$('select[id="symbol"] li:contains("XYZ")').trigger('click');
MDBootstrap staff pro premium priority answered 6 years ago
Hi salmanfaxal01,
I creaded simple snippet with solution to your request:
https://mdbootstrap.com/snippets/jquery/pjoter-2-0/805251
If you need additional help I am here for you.
Best Regards, Piotr
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.8.2
- Device: Chrome
- Browser: Chrome
- OS: Chrome
- Provided sample code: No
- Provided link: No