Interface HTMLButtonElement

All Superinterfaces:
Element, EventTarget, HTMLElement, InnerHTML, Node, NonDocumentTypeChildNode, ParentNode
All Known Implementing Classes:
HTMLButtonElementImpl

public interface HTMLButtonElement extends HTMLElement
Provides properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <button> elements.
  • Method Details

    • isAutofocus

      boolean isAutofocus()
      Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.
      Returns:
      a boolean.
    • setAutofocus

      void setAutofocus(boolean autofocus)

      setAutofocus.

      Parameters:
      autofocus - a boolean.
    • isDisabled

      boolean isDisabled()

      isDisabled.

      Returns:
      a boolean.
    • setDisabled

      void setDisabled(boolean disabled)

      setDisabled.

      Parameters:
      disabled - a boolean.
    • getForm

      HTMLFormElement getForm()
      Retrieves a reference to the form that the object is embedded in.
      Returns:
      a HTMLFormElement object.
    • getFormAction

      String getFormAction()
      Overrides the action attribute (where the data on a form is sent) on the parent form element.
      Returns:
      a String object.
    • setFormAction

      void setFormAction(String formAction)

      setFormAction.

      Parameters:
      formAction - a String object.
    • getFormEnctype

      String getFormEnctype()
      Used to override the encoding (formEnctype attribute) specified on the form element.
      Returns:
      a String object.
    • setFormEnctype

      void setFormEnctype(String formEnctype)

      setFormEnctype.

      Parameters:
      formEnctype - a String object.
    • getFormMethod

      String getFormMethod()
      Overrides the submit method attribute previously specified on a form element.
      Returns:
      a String object.
    • setFormMethod

      void setFormMethod(String formMethod)

      setFormMethod.

      Parameters:
      formMethod - a String object.
    • isFormNoValidate

      boolean isFormNoValidate()
      Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option.
      Returns:
      a boolean.
    • setFormNoValidate

      void setFormNoValidate(boolean formNoValidate)

      setFormNoValidate.

      Parameters:
      formNoValidate - a boolean.
    • getFormTarget

      String getFormTarget()
      Overrides the target attribute on a form element.
      Returns:
      a String object.
    • setFormTarget

      void setFormTarget(String formTarget)

      setFormTarget.

      Parameters:
      formTarget - a String object.
    • getLabels

      NodeList getLabels()

      getLabels.

      Returns:
      a NodeList object.
    • getName

      String getName()
      Sets or retrieves the name of the object.
      Returns:
      a String object.
    • setName

      void setName(String name)

      setName.

      Parameters:
      name - a String object.
    • getType

      String getType()
      Gets the classification and default behavior of the button.
      Returns:
      a String object.
    • setType

      void setType(String type)

      setType.

      Parameters:
      type - a String object.
    • getValidationMessage

      String getValidationMessage()
      Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting.
      Returns:
      a String object.
    • getValidity

      ValidityState getValidity()
      Returns a ValidityState object that represents the validity states of an element.
      Returns:
      a ValidityState object.
    • getValue

      String getValue()
      Sets or retrieves the default or selected value of the control.
      Returns:
      a String object.
    • setValue

      void setValue(String value)

      setValue.

      Parameters:
      value - a String object.
    • isWillValidate

      boolean isWillValidate()
      Returns whether an element will successfully validate based on forms validation rules and constraints.
      Returns:
      a boolean.
    • checkValidity

      boolean checkValidity()
      Returns whether a form will validate when it is submitted, without having to submit it.
      Returns:
      a boolean.
    • reportValidity

      boolean reportValidity()

      reportValidity.

      Returns:
      a boolean.
    • setCustomValidity

      void setCustomValidity(String error)
      Sets a custom error message that is displayed when a form is submitted.
      Parameters:
      error - Sets a custom error message that is displayed when a form is submitted.