pub const prevent_default: (&'static str, Option<&'static str>, bool);
Expand description
Prevent the default action for this element. This attribute is only recommended in the LiveView renderer which does not support the prevent default method on events.
For most renderers, you should prefer calling dioxus_core::Event::prevent_default
on the event instead.
For more information, see the MDN docs: https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault
§Usage in rsx
ⓘ
let prevent_default = "value";
rsx! {
// Attributes need to be under the element they modify
div {
// Attributes are followed by a colon and then the value of the attribute
prevent_default: "value"
}
div {
// Or you can use the shorthand syntax if you have a variable in scope that has the same name as the attribute
prevent_default,
}
};