幾個html中input標籤的細節

2022-08-05 18:33:13 字數 1177 閱讀 5387

今天在寫前台的時候遇到幾個問題,於是心血來潮去測試了一下:

1. input type="hidden"  我們經常拿來寫一些不希望被看到的屬性,但是如果寫在form中是會被跟著表單一起提交出去的。

那麼我就在想,如果給"hidden"加上disabled屬性是否還會跟著表單一起提交呢?

比如:

1

<

form

action

="result.php"

>

2<

input

type

="hidden"

name

="test"

value

="1234"

disabled

="disabled"

>

input

>

3<

input

type

="submit"

value

="click"

>

input

>

4form

>

html**

那麼在php端接收的結果看來,是不會提交該hidden資料的。

2. 那麼disabled之後,能否用jquery取到我需要的屬性呢?

alert($('input[name="test"]').attr('value'));
結果是可以獲得

3. 另外順手測試了一下如果沒有輸入 name 屬性,hidden是否提交

1

<

form

action

="result.php"

>

2<

input

type

="hidden"

value

="1234"

disabled

="disabled"

>

input

>

3<

input

type

="submit"

value

="click"

>

input

>

4form

>

html**

結果很明顯也是不會提交的

HTML中的input標籤

input標籤的type取值 text 單行文字框 取值為 text value 預設值 size 長度 maxlength 最多可以輸入的字元數 password 密碼文字框 value 預設值 size 長度 maxlength 最多可以輸入的字元數 radio單選框 name表示所在的組名 v...

Html中input標籤的使用

1.取消按鈕按下時的虛線框 在input裡新增屬性值 hidefocus 或者 hidefocus true 2.唯讀文字框內容 在input裡新增屬性值 readonly 3.防止退後清空的text文件 可把style內容做做為類引用 4.enter鍵可以讓游標移到下乙個輸入框 5.只能為中文 有...

HTML中input標籤對齊問題

今天在練習的時候遇到了一點小問題,稍作記錄希望下次遇到可以有點印象。簡單說明一下就是要編寫乙個搜尋框,搜尋框分為兩塊,一塊是左邊的文字框s text,一塊是右邊的搜尋按鈕s button,具體的html 如下 class searchbox class s text type text value ...