Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Select value using jQuery Uniform.js

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?

like image 393
solepixel Avatar asked Sep 21 '11 16:09

solepixel


2 Answers

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();
like image 112
Sander Avatar answered Nov 09 '22 19:11

Sander


Try to use the update command in the complete function:

$('.selectbox').load('index.php?get=newoptions',  function() {
  $.uniform.update('selectbox');
});
like image 29
Alexandre Mooze Avatar answered Nov 09 '22 19:11

Alexandre Mooze