Chatting with small plug-ins commonly used by select and input, chatting with selectinput

Source: Internet
Author: User
Tags jquery ui autocomplete

Chatting with small plug-ins commonly used by select and input, chatting with selectinput
Preface in pc projects, form tags are often used, such as select and input. However, the native functions are often unsatisfactory. Even if the type in the input has n attributes or even time controls, the type still cannot meet our requirements, I would like to ask how many people will use the native time control. I believe that most of the front-end, or backend, have their own plug-in repository. Requirements

Hmm ...... Currently, only the input and select labels are supported.

What are the requirements of an input box?

  • 1. Ability to input (lowest standard)
  • 2. Can be input and can be locally verified (for example, only numbers can be input and cannot be blank)
  • 3. Ability to input and locally verify and provide corresponding prompts
  • 4. Ability to input and Local verification and remote verification, and provide corresponding prompts
  • ............

Of course, there are more than these requirements.
However, native labels can meet the above two requirements at most. It's almost impossible, and the rest is the magical power of the Eight Immortals.

Here, we strongly recommend the jquery-validation plug-in. Basically, the establishment of basic mvc projects will help you install this plug-in very well. The rest is waiting for you to call.

This is a good verification plug-in, not only with front-end verification, but also with ajax remote verification. Very good

Well, it's a long journey. What I want to talk about is that in addition to the necessary requirements mentioned above, some requirements are also very common. For example, if you click the input box, there will be a beautiful time plug-in. We recommend one or two plug-ins ...... Bootstrap-datepicker, bootstrap-daterangepicker

However, this is not the case, but the drop-down box selection is displayed in the input match, as shown in figure

Well ...... This is the case.

 

 

The source code is as follows:

 1 <!doctype html> 2 

 

Here we use a small plug-in called autocomplete.

Jquery is still very powerful

Declaration, we are currently using. net mvc. Before that, I cooperated with the java background and separated the front and back ends. In the past year, the front-end is also written, and c # is also written. The biggest feeling is that if one person writes a project, there will indeed be fewer steps, but after all, one person can do nothing. Even if you are all-powerful enough, it is difficult to have such full energy.

By the way, I am a loyal user of es6 syntax and vue2, react, angular framework. Unfortunately, we use razor syntax. It is not difficult to say, but as far as the frontend is concerned, the above are certainly more powerful and convenient.

In this case, in the face of endless demands, we can only look back at jquery again.

In addition to the above requirements, there is also a requirement that we often use, that is, select, yes, you did not see, it is the select label, this label carries many things. Let's look at the figure and we will know.

  • 1. First, you must be able to bind remote data.
  • 2. You have to be able to obtain the selected callback. Otherwise, your interaction will be almost complete.
  •  

Here is a deep hole in the front-end, that is, the performance style of native select in ios and windows systems is very different. If you are interested, try it on your own, therefore, the native select tag is almost useless.

The function shown in the figure above is a plug-in named select2.

In fact, I think this should be very famous. After all, 20 k stars are there.

In the top figure, the input that we mentioned matches the small jquery plug-in. We have to lament that Ginger is still a hot plug-in.

When you go to the jquery official website and download the latest jquery, you can observe plugins. There should be thousands of plug-ins under visual testing, and autocomplete is just one of them.

 

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.