A brief discussion on name, value in input and for in label
Oct 10, 2018 pm 05:35 PMThis article will briefly talk about name, value in input and for in label. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Input has many attributes, the more commonly used ones are type, value, name, placeholder, multiple, checked, etc. I have always been confused about the name, value, label and the text outside the label, but I finally figured it out today.
1) name attribute
Definition: The name attribute specifies the name of the input element.
Usage: The name attribute is used to identify the form data after it is submitted to the server, or to reference the form data through JavaScript on the client.
Note: Only form elements with the name attribute set can pass their values ??when submitting the form.
In other words, name is of no use for page display (adding it or not does not affect page display), but is used for easy reference when interacting with the server or writing js.
2) value attribute
Definition: The value attribute sets the value for the input element.
Usage: For different input types, the usage of the value attribute is also different:
type="button", "reset", " submit" - Define the text displayed on the button
<input>按鈕文字
type="text", "password", "hidden" - Defines the initial value of the input field
<input>標(biāo)簽外
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
- ##type= "checkbox", "radio", "image" - Defines the value associated with the input What is displayed on the page is the "button text" (text outside the label), and the value at this time is mainly used for interactive operations in js, so the value at this time is generally set to a value related to the input. For example:
-
<input>按鈕文字
Note: The value attribute must be set in and .
3) label
The above is the detailed content of A brief discussion on name, value in input and for in label. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Kernelsecuritycheckfailure (kernel check failure) is a relatively common type of stop code. However, no matter what the reason is, the blue screen error causes many users to be very distressed. Let this site carefully introduce 17 types to users. Solution. 17 solutions to kernel_security_check_failure blue screen Method 1: Remove all external devices When any external device you are using is incompatible with your version of Windows, the Kernelsecuritycheckfailure blue screen error may occur. To do this, you need to unplug all external devices before trying to restart your computer.

Preparation Use vuecreateexample to create a project. The parameters are roughly as follows: use native input. Native input is mainly value and change. The data needs to be synchronized when changing. App.tsx is as follows: import{ref}from'vue';exportdefault{setup(){//username is the data constusername=ref('Zhang San');//When the input box changes, synchronize the data constonInput=;return( )=>({

How to implement the laravel input hidden field: 1. Find and open the Blade template file; 2. Use the method_field method in the Blade template to create a hidden field. The creation syntax is "{{ method_field('DELETE') }}".

Can Win10 skype be uninstalled? This is a question that many users want to know, because many users find that this application is included in the default program on their computers, and they are worried that deleting it will affect the operation of the system. Let this website help users Let’s take a closer look at how to uninstall Skype for Business in Win10. How to uninstall Skype for Business in Win10 1. Click the Windows icon on the computer desktop, and then click the settings icon to enter. 2. Click "Apply". 3. Enter "Skype" in the search box and click to select the found result. 4. Click "Uninstall". 5

Solutions for clicking the input box without a cursor: 1. Confirm the focus of the input box; 2. Clear the browser cache; 3. Update the browser; 4. Use JavaScript; 5. Check the hardware device; 6. Check the input box properties; 7. Debug JavaScript code; 8. Check other elements of the page; 9. Consider browser compatibility.

How to use for to find n factorial: 1. Use the "for (var i=1;i<=n;i++){}" statement to control the loop traversal range to "1~n"; 2. In the loop body, use "cj *=i" Multiply the numbers from 1 to n, and assign the product to the variable cj; 3. After the loop ends, the value of the variable cj is the factorial of n, and then output it.

php提交表單通過后,彈出的對話框怎樣在當(dāng)前頁彈出php提交表單通過后,彈出的對話框怎樣在當(dāng)前頁彈出而不是在空白頁彈出?想實現(xiàn)這樣的效果:而不是空白頁彈出:------解決方案--------------------如果你的驗證用PHP在后端,那么就用Ajax;僅供參考:HTML code

Difference: 1. for loops through each data element through the index, while forEach loops through the data elements of the array through the JS underlying program; 2. for can terminate the execution of the loop through the break keyword, but forEach cannot; 3. for can control the execution of the loop by controlling the value of the loop variable, but forEach cannot; 4. for can call loop variables outside the loop, but forEach cannot call loop variables outside the loop; 5. The execution efficiency of for is higher than forEach.
