Closed danielinniss closed 12 years ago
This is broken for me too. You can make it change by changing the value of the hidden input that follows the select, but this seems like badness to me.
Really? that didnt seem to work for me, changinf the underlying select list. my entire script is built to do just that. I'll give it a go
Here's the workaround I came up with:
$("#select_id").next().val("Female"); $("#select_id").val("Female");
The first one changes the value that is displayed. The second one changes the value that is submitted with the form.
$('#select_id').val(""); $('#select_id').trigger('change');
Yes, the change event does not fire on the select box unless there is an actual browser event. So, instead of adding another method, the preferred method is to change the value of the original select box and then manually trigger the change event, something like this:
$originalSelect.val(newValue).trigger('change');
When you try and use jquery to change the selected item (such as a reset button) nothing happens. Sparkbox seems to break something. Even the underlying select lists do not change.
I have tested my functions with sparkbox on and off. Works when off but is broken when sparkbox is on
reproduce by trying to set the value of a select list while using sparkbox $("select#elementid").val('a value')