Typ tlačítka Vlastnost
Příklad
Vraťte typ tlačítka:
var x = document.getElementById("myBtn").type;
Definice a použití
Vlastnost type nastavuje nebo vrací typ tlačítka.
Tip: Vždy zadejte atribut typu tlačítka. Výchozí typ pro Internet Explorer je „tlačítko“, zatímco v jiných prohlížečích (a ve specifikaci W3C) je „odeslat“.
Podpora prohlížeče
Property | |||||
---|---|---|---|---|---|
type | Yes | Yes | Yes | Yes | Yes |
Syntax
Vraťte vlastnost type:
buttonObject.type
Nastavte vlastnost type:
buttonObject.type = "submit|button|reset"
Hodnoty vlastností
Value | Description |
---|---|
submit | The button is a submit button (this is default for all browsers, except Internet Explorer) |
button | The button is a clickable button (this is default for Internet Explorer) |
reset | The button is a reset button (clears form data) |
Technické údaje
Návratová hodnota: | Řetězec představující typ tlačítka |
---|
Další příklady
Příklad
Změňte typ tlačítka na „odeslat“:
document.getElementById("myBtn").type = "submit";
Příklad
Změňte typ tlačítka na "resetovat":
document.getElementById("myBtn").type = "reset";
Související stránky
HTML reference: HTML atribut typu <button>
❮ Tlačítko Objekt