隐藏数据 ‹input type='hidden'›

isixe 2020-06-06 16:15:15
Categories: Tags:

 

 

属性

说明

name

这实际上是常见属性之一,但它对于隐藏的 <input> 具有一个特殊含义。

一般来说,name 的属性在隐藏 <input> 上的作用和任何其他 <input> 上的一样;但是,在提交表单时, name 属性被设置为 _charset_ 的隐藏 <input>,其值会被自动设置为被提交表单的字符编码

示例

<!DOCTYPE html>

<html lang="en">

 

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

</head>

 

<body>

    <form method="post" enctype="multipart/form-data">

        <input id="prodId" name="prodId" type="hidden" value="xm234jq">

    </form>

</body>

 

</html>

 

 

来自 <https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/Input/hidden>