Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize single selection and multiple selection of select tags in HTML

Shulou Source: shulou.com Published: 2022-06-01 06:13:23 10月03日 Update

This article mainly shows you the "select tags in HTML how to achieve single-selection and multi-selection", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to achieve single-selection and multi-selection of select tags in HTML" this article.

1. Basic usage:

Volvo

Saab

Opel

Audi

Among them, the tag can be omitted and used in the page.

All

Network Learning Center of Hubei Radio and TV University

Online Learning Center of Chengdu normal University

Network Learning Center of Wuhan Vocational and Technical College

Second, you can select more than one Select element, as shown in the following code:

/ / if there is a multiple attribute, you can select more than one.

high school

University

doctor

/ / there is no multiple attribute below. Only one item is displayed. You cannot select more than one attribute.

high school

University

doctor

/ / the following is the case where the size attribute is set. If size=3 is set, then three pieces of data are displayed. Note that you cannot select more than one.

Primary school

Junior middle school

high school

Technical secondary school

Junior college

Undergraduate course

Graduate student

doctor

Postdoctoral

Please select

Third, all the common operations involved in selecting multiple Select components:

1. Determine whether there is an Item of the specified value in the select option

@ paramobjSelectId the id of the target select component to be verified

The value that @ paramobjItemValue will verify whether it exists

FunctionisSelectItemExit (objSelectId,objItemValue) {

VarobjSelect=document.getElementById (objSelectId)

VarisExit=false

If (nullroomroomobjSelectautomatically automatically typed of (objSelect)! = "undefined") {

For (vari=0;i

Tags: Components goals messages learning prompts tags content PhD mobile validation learning centers properties articles web high school success between universities colleges commas Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft MySQL Xiaomi Shulou Technology Docker