--- title: Manuals tagline: MsDropdown date: 2021-03-07 00:00:00 description: > The template comes with a Web included, a skeleton for a new website created with J1 Template. This Web is called the "Starter web", a general-purpose scaffold to be modified for your needs. keywords: > msdropdown, manual, usage, attribute, callback, option, opensource, free, load, download, start, starter, example, high, easy, use, secure, encrypt, standard, popular, generate, develop, create, learn, distribute, publish, deploy, beginner, advanced, expert, student, learner, writer, reader, visitor framework, toolkit, integration, extension, module, api, dynamic, static, generator, client, server, internet, local, localhost page, web, website, webdesign, material, design, responsive, javascript, nodejs, ruby, windows, linux, osx, mac, os, http, https, html, html5, css, scss, style, browser, firefox, chrome, edge, opera, safari, configuration, generator, navigation, menu, dropdown, fab, action, button application, interface, provider, api, repository, cookie, language, translation, gdpr, dsgvo, privacy, asciidoc, aciidoctor, bootstrap, jekyll, liquid, hyvor, disqus, git, github, netlify, heroku, apple, microsoft, provider, service, internet, support, google, analytics, advertising, search, console, silverlight, score, j1, template, jekyllone, comment categories: [ Manuals ] tags: [ MsDropdown ] comments: true fab_menu_id: page_ctrl_simple permalink: /pages/public/manuals/msdropdown/ regenerate: false resources: [ clipboard, comments, rouge, animate ] resource_options: - attic: padding_top: 400 padding_bottom: 50 opacity: 0.5 slides: - url: /assets/images/modules/attics/matthew-dockery-1920x1280.jpg alt: Photo by Matthew Dockery on Unsplash badge: type: unsplash author: Matthew Dockery href: https://unsplash.com/@matt_dockery --- == MsDropdown properties === Attributes Besides selectedIndex, options, name, size, multiple, etc attributes/properties, msDropdown reads below attributes too. .msDropdown attributes [cols="4a,8a", options="header", width="100%", role="rtable mt-3"] |=== |Name |Description |`autofocus` |As the name suggests, this attribute lets you choose that a form control should have autofocus when the page is loaded. Only one element can have autofocus. |`disabled` |If this property is enabled, you won't be able to interact with the element. |`form` |It returns the name of the
element to associate the element. |`required` |A Boolean attribute indicating that an option with a non-empty string value must be selected. Here is a surprise; you can change the default message too. Just set the `data-error-message="Your custom message here"` in ` name is "tech" and checkbox is enabled, tech_mscheck[] will be posted as an array. The default value is: `{select_name}_mscheck` |`data-enable-auto-filter` |It lets you search by typing any key when msDropdown is open. Just like auto-suggest. The default value is: `true` |`data-visible-rows` |If you set this attribute, it calculates the max height of the items and sets the child height based on the number provided in value. You can also achieve this by using the data-child-height property, only that set in pixels. The default value is: `null` |`data-show-plus-item-counter` |If multiple is true and you select more than one item; it shows a text +N. N denotes numbers here. The default value is: `true` |`data-error-message` |If `required` is enabled in . I should mention here; msDropdown borrows the name from the original dropdown to work the "required" attribute. |`required` |A Boolean attribute indicating that an option with a non-empty string value must be selected. Here is a surprise; you can change the default message too. Just set the `data-error-message="Your custom message here"` in `. And it returns the removed item with uiData. + [source, js] ---- /** * @param index {int} * @return uiData */ remove(index) ---- |`next` |Move to the next index/item + [source, js] ---- next() ---- |`previous` |Move to the previous index/item + [source, js] ---- previous() ---- |`open` |Open the dropdown + [source, js] ---- open() ---- |`close` |Close the dropdown + [source, js] ---- close() ---- |`namedItem` |If you have given any name of an option, will be returned. say, + [source, js] ---- /** * @param name {string} * @param withData {boolean} */ namedItem(name, withData) ---- |`item` |Return ` ---- [start=2] . You don't need the below code if you have already included `dd.min.js` in the bottom of the page. Like I've mentioned in the installation section. + In case you want to convert later by script, you can use the below code. You may use a CSS selector too. + [source, js] ---- MsDropdown.make('#select_element'); //or new MsDropdown('.select_elements'); ---- === Dropdown with description Did you notice? There is an extra attribute `data-description` in `