div Simulation dropdown menu select control module CSS Implementation form select landscaping

Source: Internet
Author: User

The div CSS simulation realizes the form form Drop-down Select control beautification and the function realization. Can implement simulation of the Select form Drop-down submit data transfer function

How to use and how to call: $.divselect ("#divselect", "#inputselect"); "#divselect" This is which analog list of the box ID, "#inputselect" This is the choice to id= "Inputselect" of the input hidden field assigned value OH. Understand a little program to understand why to assign value. It means that assigning a value to this hidden field is equivalent to using an ugly select Drop-down list to get a value. The function of the Drop-down list is simply to pass a value to the past.

This form select Drop-down control is implemented using DIV+JQ+CSS, whose form functions are normally used and can be transmitted correctly. Change the CSS background, CSS width, css height, and other pictures or CSS styles as needed to achieve your desired select Drop-down menu form beautification effect.

The jquery plug-in code is as follows:

 
  
  
  1. Jquery.divselect = function (Divselectid,inputselectid) {
  2. var inputselect = $ (Inputselectid);
  3. $ (divselectid+ "cite"). Click (function () {
  4. var ul = $ (divselectid+ "ul");
  5. if (Ul.css ("display") = = "None") {
  6. Ul.slidedown ("fast");
  7. }else{
  8. Ul.slideup ("fast");
  9. }
  10. });
  11. $ (divselectid+ "ul li a"). Click (function () {
  12. var txt = $ (this). text ();
  13. $ (divselectid+ "cite"). HTML (TXT);
  14. var value = $ (this). attr ("Selectid");
  15. Inputselect.val (value);
  16. $ (divselectid+ "ul"). Hide ();
  17. });
  18. };

The DIV Simulation drop-down menu (SELECT) jquery plug-in invocation method is as follows:

 
  
  
  1. <script type= "Text/javascript" >
  2. $ (function () {
  3. $.divselect ("#divselect", "#inputselect");
  4. });
  5. </script>

The corresponding HTML source code fragment is as follows:

 
  
  
  1. <form action= " method=" POST "> 
  2. <div id=" Divselect ">  
  3. <cite> Select effects category </cite> 
  4. <ul> 
  5. <li><a  href= "javascript:;"  selectid= "1" > Navigation menu </a></li> 
  6. <li><a href= "javascript:;"  selectid= "2" > Drop-down Select Effect </a></li> 
  7. <li><a href= "javascript:;"  selectid= "3" >select analog </a></li> 
  8. <li><a href= "javascript:;"  selectid= "4" >divcss5 special effects </a></li> 
  9. <li><a href= "javascript:;"  selectid= "5" >jquery  pull-down menu effects </a></li> 
  10. </ul> 
  11. </div > 
  12. <input name= " type=" hidden " value=" " id=" Inputselect "/> "
  13.  
  14. </form> 
Related Article

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.