Wednesday, November 25, 2009

Useful jQuery Tips for Select Lists

If you are into using jQuery and need to manage select lists, here are some really useful tips.

http://www.myphpetc.com/2009/03/jquery-select-elements-tips-and-tricks.html

By the way, I wrote my own routine for using an array to save a select list and its selected index when the page loads:

//Save all initial options
    var saveselect = new Array();
    $('#myselect option').each(function() {
        saveselect[this.value] = this.text;
    });
    //Save inital selected index
    var saveindex = $("#myselect option").index($("#myselect option:selected"));

No comments: