In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to use select2 in jquery. I hope you will get something after reading this article. Let's discuss it together.
In jquery, select2 is used to optimize select to support single and multiple selections, as well as group display and list retrieval. It is a jquery-based drop-down list plug-in with a call syntax of "$(select). Select2 ()".
The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.
Select2 is a JQuery-based drop-down list plug-in, mainly used to optimize select, support single-selection and multi-selection, but also support group display, list retrieval.
Select2 is a component that Jquery uses instead of a selection box. It allows you to customize drop-down boxes and support search, tagging, remote data sources, unlimited scrolling and other more advanced functions.
The download address of select2 is https://select2.github.io/. The version of select2-4.0.0 is used here. After downloading this version, extract the file, and there are js and css files in the dist directory. To use select, you need to reference these files.
First of all, we will introduce the css and js that we just downloaded into the project, and we need to introduce jquery before introducing select2.js.
Note that both css and js in the downloaded select2 folder have compressed and uncompressed versions, which can be introduced according to your own needs. Here, the compressed version is introduced.
The invocation syntax is as follows:
$(function () {$("# myselect") .select2 (); / / call plug-in})
Of course, we need to configure it as an object as a parameter of select2 () in "$(" # myselect "). Select2 (). For example, we can set the width of the select width:
$("# myselect"). Select2 ({width:160,// sets the width of the select tag}); after reading this article, I believe you have some understanding of "how to use select2 in jquery". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.