Skip to main content

TextControlElement

Trait TextControlElement 

Source
pub trait TextControlElement: FormControlElement {
    // Provided methods
    fn value(&self) -> String { ... }
    fn set_value(&self, value: impl Into<String>) { ... }
    fn placeholder(&self) -> String { ... }
    fn set_placeholder(&self, placeholder: impl Into<String>) { ... }
    fn readonly(&self) -> bool { ... }
    fn set_readonly(&self, readonly: bool) { ... }
    fn max_length(&self) -> Option<u32> { ... }
    fn set_max_length(&self, max: u32) { ... }
}
Expand description

Shared behavior for text-editing form controls (input, textarea).

Chrome equivalent: TextControlElement. Adds value, selection, and text editing capabilities.

Provided Methods§

Source

fn value(&self) -> String

The current text value.

Source

fn set_value(&self, value: impl Into<String>)

Source

fn placeholder(&self) -> String

The placeholder text shown when the control is empty.

Source

fn set_placeholder(&self, placeholder: impl Into<String>)

Source

fn readonly(&self) -> bool

Whether the control is read-only (value visible but not editable).

Source

fn set_readonly(&self, readonly: bool)

Source

fn max_length(&self) -> Option<u32>

Maximum number of characters allowed.

Source

fn set_max_length(&self, max: u32)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§