Prevent first option topOptionText from being clickable #14

Open
amazingBytes opened this Issue Mar 22, 2012 · 0 comments

Comments

Projects
None yet
1 participant
@amazingBytes

To prevent the first option from being clickable I'd like to suggest the following addition of a function and a slightly change of code.

New function:

//function to create first option in the select menu
function createFirstOption($container){

        $('<option selected="selected" disabled="disabled" value="0">'+settings.topOptionText+'</option>').appendTo($container);
}//createFirstOption()

Within the function createSelect() use instead of

    //create default option if the text is set (set to null for no option)
    if(settings.topOptionText){
        createOption($('<li>'+settings.topOptionText+'</li>'), $select);
    }

the code

    //create default option if the text is set (set to null for no option)
    if(settings.topOptionText){
        createFirstOption($select);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment