Topic: Select object not updating displayed value
Dylan Keith free asked 3 years ago
Expected behavior: When the value of a select object is changed, the displayed selected object should be updated as well.
Actual behavior: Value is updated in the backend, but not displayed in the select object
Resources (screenshots, code snippets etc.)
This select object works fine: select class="browser-default custom-select"
but the mdb select object: select class="mdb-select md-form" does not update after changing the value via JS.
I've searched through the documentation a number of times and can't find anything on this, except for a message saying:
"In addition, you will need a separate call for any dynamically generated select elements your page generates."
But no information on what call to make.
If it works it fine then but try maybe this
I'm not trying to add new elements to the select, but rather I want to change the value/display of the object for the user. For instance, if an object(mongodocument) is loaded to the edit page, it might update the category to 'Prospect' as below. This part works as expected, but when I load a second document, the displayed object is still "Prospect" even if the actual value might now be "General Update". I was able to find a work around by re-initializing the select object after each data call. Is this the best solution? or is there a better way to dynamically update the select
value of the select = "Prospect" via document.getElementById('category').value
Value of the select = "Quote" via document.getElementById('category').value after via document.getElementById('category').value="Quote" but the select still displays Prospect
I'm trying to reopen your problem is this something similar to your expect
If it doesn't please show me your AJAX code and all js
Can you show your code in snippet code editor
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.19.0
- Device: Desktop
- Browser: Firefox / Chrome
- OS: Windows
- Provided sample code: No
- Provided link: No