Topic: How to programmatically set a value SELECT
Supplier Management pro asked 7 years ago
how to select the option value "H" without using the method $('.select-dropdown li:contains("H")')?PleaseBecause I have a lot of list to select with options that start with an H.<form class="form-inline"><select class="mdb-select colorful-select dropdown-primary" id="selectGender"><option value="" disabled selected>Sexe</option><option value="H">Homme</option><option value="F">Femme</option></select></form>
Mikołaj Smoleński staff answered 7 years ago
$('#InitialManager').change(function () { var values = $(this).val(); console.log(values); });Regards
Mikołaj Smoleński staff commented 7 years ago
If You want to select options programmatically You just need to create an array with option values and put it inside val(...)Mikołaj Smoleński staff commented 7 years ago
For example: optionValues = ['2', '3']; $('#InitialManager').val(optionValues); var values = $('#InitialManager').val(); console.log(values);Mikołaj Smoleński staff answered 7 years ago
Supplier Management pro answered 7 years ago
Mikołaj Smoleński staff answered 7 years ago
Supplier Management pro answered 7 years ago
Supplier Management pro answered 7 years ago
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- Premium support: No
- Technology: MDB jQuery
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: Yes
- Provided link: No