06.08.2024, 06:19
Select example:
Custom values are not implemented for floating point values because they don't always have an exact value.
Code:
$(function() {
var sel = $('<select></select>')
.css({
position: 'absolute',
top: '100px',
left: '200px',
})
.appendTo('#plan-1')
var opts = [
{ value: 1, text: 'First' },
{ value: 2, text: 'Second' },
{ value: 3, text: 'Third' },
]
for (var opt of opts) {
$('<option>')
.attr('value', opt.value)
.text(opt.text)
.appendTo(sel)
}
sel.on('change', function() {
var value = sel.val()
console.log('selected value', value)
})
})
Custom values are not implemented for floating point values because they don't always have an exact value.