Topic: [BUG] select setValue does not accept numbers
gianlucagiacometti priority asked 1 month ago
Let us suppose to have a button with the attribute data-myvalue="23456" and a select which contains an option with that value.
If we use jquery to get the data value, this should work:
Actually, the value is not set properly because it is not a string. The select resets to the first value.
In my opinion, this additional check should be done directly by the funcion setValue, not by the user. Sometimes we do not know if the value is a string or a number a priori.
You just need to add String() in the setValue function
If we use vanilla js the getAttribute('data-myvalue') function gives always a string and there seems to be no issue
I prepared a snippet:
You probably did not "Publish" your snippet since I cannot access it.
But thanks for voicing your opinion we will take this into consideration.
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Priority
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 5.0.0
- Device: All
- Browser: All
- OS: All
- Provided sample code: No
- Provided link: Yes