Use label tag to select the radio button by clicking the text

Use label tag to select the radio button by clicking the text
The <label> tag defines a label (tag) for an input element. The label element does not present any special effect to the user. However, it improves usability for mouse users. This control is triggered if you click on the text within the label element. That is, when the user selects the tag, the browser automatically shifts the focus to the form control associated with the tag. The for attribute of the <label> tag should be the same as the id attribute of the associated element

Example 1:

Copy code
The code is as follows:

<label for="man">
<input type="radio" value="男" name="man" id="man"/>
male
</label>
<label for="man2">
<input type="radio" value="女" name="man" id="man2"/>
female
</label>

Example 2:

Copy code
The code is as follows:

<input type="checkbox" name="Pages" value="Job" id="Job" ><label for="Job">Add and edit job information</label>

<input type="checkbox" name="Pages" value="JobQuery" id="JobQuery" &gt;<label for="JobQuery">Query and delete recruitment information</label>

<input type="checkbox" name="Pages" value="Technology" id="Technology" checked&gt;<label for="Technology">Add or modify technology items</label>

<<:  Sample code for using CSS to write a textured gradient background image

>>:  MYSQL METADATA LOCK (MDL LOCK) theory and lock type test

Recommend

CSS3 flip card number sample code

I received a task from the company today, and the...

CSS to achieve the image hovering mouse folding effect

CSS to achieve the image hovering mouse folding e...

What are the drawbacks of deploying the database in a Docker container?

Preface Docker has been very popular in the past ...

The table merges cells and the img image to fill the entire td HTML

Source code (some classes deleted): Copy code The ...

MySQL/MariaDB Root Password Reset Tutorial

Preface Forgotten passwords are a problem we ofte...

Detailed explanation of mysql user variables and set statement examples

Table of contents 1 Introduction to user variable...

How to configure ssh/sftp and set permissions under Linux operating system

Compared with FTP, SSH-based sftp service has bet...

Explanation of the usage of replace and replace into in MySQL

MySQL replace and replace into are both frequentl...

Analysis of the differences between Iframe and FRAME

1. Use of Iframe tag <br />When it comes to ...

Do you know all 24 methods of JavaScript loop traversal?

Table of contents Preface 1. Array traversal meth...

React implements infinite loop scrolling information

This article shares the specific code of react to...