fix onclick event
This commit is contained in:
1 parent
c645e1c6aa
commit
f044bb2128
3 files changed
+32
-118
No files matched your search
@@ -15,12 +15,12 @@ fn module_loader(root_name: &str) -> String {
|
||||
let inputs = document.querySelectorAll("input");
|
||||
for (let input of inputs) {
|
||||
if (!input.getAttribute("data-dioxus-file-listener")) {
|
||||
input.setAttribute("data-dioxus-file-listener", true);
|
||||
input.addEventListener("click", (event) => {
|
||||
let target = event.target;
|
||||
// prevent file inputs from opening the file dialog on click
|
||||
const type = target.getAttribute("type");
|
||||
if (type === "file") {
|
||||
// prevent file inputs from opening the file dialog on click
|
||||
const type = input.getAttribute("type");
|
||||
if (type === "file") {
|
||||
input.setAttribute("data-dioxus-file-listener", true);
|
||||
input.addEventListener("click", (event) => {
|
||||
let target = event.target;
|
||||
let target_id = find_real_id(target);
|
||||
if (target_id !== null) {
|
||||
const send = (event_name) => {
|
||||
@@ -30,8 +30,8 @@ fn module_loader(root_name: &str) -> String {
|
||||
send("change&input");
|
||||
}
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}"#,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user