前端學習(7)文字框 單選框 多選框

2021-10-07 18:46:07 字數 1593 閱讀 4191

表單元素格式

屬性1說明

type

指定元素的型別。text、password、checkbox、radio、submit、reset、file、hidden、image和button,預設為text

name

指定表單元素的名稱

value

元素的初始值。type為radio時必須指定乙個值

size

指定表單元素的初始寬度。當type為text或password時,表單元素的大小以字元為單位。對於其他型別,寬度以畫素為單位

maxlength

type為text或password時,輸入的最大字元數

checked

type為radio或checkbox時,指定按鈕是否是被選中

>

名字:type

="text"

name

="username"

>

p>

>

密碼:type

="password"

name

="password"

>

p>

>

性別:type

="radio"

value

="boy"

name

="***"

>

type

="radio"

value

="girl"

name

="***"

>

女 p

>

>

type

="submit"

>

type

="reset"

>

p>

>

愛好:type

="checkbox"

value

="sleep"

name

="hobby"

>

睡覺

type

="checkbox"

value

="code"

name

="hobby"

>

敲**

type

="checkbox"

value

="chat"

name

="hobby"

>

聊天

type

="checkbox"

value

="game"

name

="hobby"

>

遊戲 p

>

>

按鈕:type

="button"

name

="btn"

value

="按鈕"

jQuery獲取及設定單選框 多選框 文字框

jquery獲取及設定單選框 多選框 文字框 獲取一組radio被選中項的值 findkind 為單選框的值 var item input name findkind checked val var item input name findkind val 隱藏單選框 input name find...

HTML5 學習12 文字框和單選框

屬性 說明 type 指定元素的型別。text password checkbox submit reset file hidden image和button,預設為text name 指定表單元素的名稱 value 元素的初始值。type為radio時必須指定乙個值 size 指定表單元素的初識寬...

學習 jQuery下拉框,單選框,多選框整理

獲取一組radio被選中項的值 var item input name items checked val 獲取select被選中項的文字 var item select name items option selected text select下拉框的第二個元素為當前選中值 select id ...