Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

iterate over options #490

Closed
Closed

Description

@andreagosto

Hi, i can't understand how i can iterate over all options element. I'm sorry, it must be a very basic function, but maybe is not too much intuitive! can someone help me?

Activity

  1. brianreavis commented on Jun 29, 2014

    @brianreavis
    Member
    var $select = $('select').selectize({...});
    
    // <option> elements
    var $options = $('option', $select);
    // selectize options (an object)
    var options = $select[0].selectize.options;
  2. JamesWilsonProjects commented on Apr 10, 2015

    @JamesWilsonProjects

    Just in case anyone else finds this question while attempting to iterate over the options object. Assuming brianreavis' code above, you can iterate over the "options" variable using: Object.keys(options).

  3. verybigelephants commented on Oct 18, 2022

    @verybigelephants
    for(key in $select[0].selectize.options){
        console.log($select[0].selectize.options[key]);
    }
    
  4. locked and limited conversation to collaborators on Oct 18, 2022
  5. converted this issue into a discussion #1882 on Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions