Custom select simulation-based on jQuery

Source: Internet
Author: User

Description

Simulate select to implement styles not implemented by native select

Add the html structure to the Html page, and separate css and js.

The developer can introduce the relevant file and convert the style with $ (). selectbox (). When there is an update, the selectbox will not generate duplicate html and will not rebind events.

The unique parameter of selectbox is that when the script in the html structure is not J_SelectBoxHtml, the expr of the script is passed in.

Support for ie6-10, ff, chrome, safari, opera

Supports select items

Optgroup items supporting select

Select change events are supported.

The select change rule is supported. If the value is not changed, the change rule is not triggered. If the value is changed, the change rule is triggered.

Add the select change rule. When the data-change = "click" attribute is added to the select statement, the change event is triggered regardless of whether the value changes or not.

The disalbed attribute of select is supported.

Equal to select

Supports select Boundary Control

Html structure example
<Span class = "select_box" <script type = "text/selectbox" id = "J_SelectBoxHtml"> // select container <% WRAP %> <span class = "select_box" style = "z-index: 100; "> </span> <%/WRAP %> // select sibling <% BODY %> <span class =" select_up "> <span class =" select_up_text "> </span> <B> </span> <span class = "select_list" style = "display: none; "> </span> <%/BODY %> // option item <% OPTION %> <a href =" javascript :; "data-value =" {value }}" >{{ text }}</a> <%/OPTION %> // optgroup item label, optional <% GROUPLABEl %> <a href = "javascript :; "data-group =" J_Group {index} ">{{ text }}< B class =" icon "/> </a> <%/GROUPLABEl %> // optgroup container, optional <% GROUPWRAP %> <div class = "erji J_Group {index}" style = "display: none; "> <% = OPTION %> </div> <%/GROUPWRAP %> </script>
Demo

Demo

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.