I'm using uniform.js for jQuery and I need to change the values of the select item programmatically. It seems to change the actual <select> field, but the uniform element doesn't change. What is the proper way to do this, other than manually looking up the HTML for the option, then setting the uniform element to that value?
Asked
Active
Viewed 2.1k times
2 Answers
40
After setting the value as usual, you need to tell uniform to update the element.
$.uniform.update("#myUpdatedSelect");
or as the documentation says, if you are lazy you can let it update ALL elements
$.uniform.update();

Kalel Wade
- 7,742
- 3
- 39
- 55

Sander
- 13,301
- 15
- 72
- 97
-
I was seriously about to give up, until I check closely the code and figure out my value was updating fine but freaking uniformjs didn't updated the span that holds the value.. thank you! – Roberto Apr 23 '13 at 04:08
3
Try to use the update command in the complete function:
$('.selectbox').load('index.php?get=newoptions', function() {
$.uniform.update('selectbox');
});

Tisho
- 8,320
- 6
- 44
- 52

Alexandre Mooze
- 31
- 1