Skip to content

[Dropdown] Trigger native actions on mobile #181

@brigand

Description

@brigand

In addition to what already exists...

<div class="ui selection dropdown">
    <select name="gender" data-default="Gender">
        <option value="male">Male</option>
        <option value="female">Female</option>
    </select>
</div>
$('.ui.selection.dropdown').dropdown();

So, what happens if the first child is a select element?

  • hide the select element
  • insert the dropdown icon
  • insert the default text if defined
  • insert the items based on the text and value of each option
  • watch for change events on the select element
  • allow the dev to rebuild it at any time (e.g. if options change)

Benifits:

  • great fallback for if a dev doesn't load jQuery and/or semantic.js
  • works well with MVC, MVVM, server forms (Django, Rails, ASP, etc.)
  • less code
  • devs can decide criteria for making it turn into a SUI dropdown
    • if A: $('.ui.dropdown').dropdown();
    • if not A: cool, it'll just be a select element

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions