solepixel
solepixel

Reputation: 807

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?

Upvotes: 21

Views: 21490

Answers (2)

Sander
Sander

Reputation: 13431

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();

Upvotes: 40

Alexandre Mooze
Alexandre Mooze

Reputation: 31

Try to use the update command in the complete function:

$('.selectbox').load('index.php?get=newoptions',  function() {
  $.uniform.update('selectbox');
});

Upvotes: 3

Related Questions