I am using this function to change a range input value with javascript
changeMenuValue : function(element, newValue){
document.getElementById(menuElements[element].id).value = newValue;
},
the function works for a text input field but will not change the range input here is an example
app.changeMenuValue(rangeElementId, 17);
console.log(rangeElement.value);
this code logs the initial value of the element still not the new value (17)
I have also tried the jQuery way
$("#rangeElementId").val(somevalue);
$("#rangeElementId").attr('value', '1');
代码app.changeMenuValue(rangeElementId, 17)
将id和值传递给该函数,但函数changeMenuValue : function(element, newValue)
需要一个元素和值。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.