I am using a dropdown to allow the user to sort search results. These results in a table but not all of the sortable criteria are represented by columns. The columns can be sorted by either clicking on the column header or using a 'Sort By' dropdown. The user can reverse the sort by clicking on the sorted columns header. I am trying to duplicate this functionality in the drop down but can't get it to work in IE7/IE8.
The following is the existing code that works in both IE and Firefox. It changes the sorted column but not the sort direction.
$("#sortSelect").change(function() {
//change sort
});
This is what I am trying to change it to and it works in Firefox. It changes the sorted column and if the sorted columns is already selected it will change the sort direction.
$("#sortSelect option").click(function() {
//change sort
});
I was hoping someone would know of a way to trigger the option.click event or know of a good workaround.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…