ตั้งค่ากับ vanila js ใน dom ธาตุคืนค่าไม่ได้ทำงาน

0

คำถาม

enter image description hereนี่เป็นเว็บไซต์ https://secure.givelively.org/donate/lifesteps ฉันอยากจะประเภทรใช้ค่าตั้งเองอยู่ที่นี่กับง่ายอย่าง js/jquery มันไม่ทำงานเมื่อคลิกที่ปุ่มทำต่อไป

ฉันพยายาม

document.querySelector("#custom-input-element").click()

แล้ว

 document.querySelector("#custom-input-element").focus()

แล้ว

document.querySelector("#custom-input-element").value='1';

พวกเขาทั้งหมไม่ได้ทำงาน

dom javascript jquery
2021-11-23 05:41:34
2

คำตอบที่ดีที่สุด

1
let elem = document.getElementById("custom-input-element");  
const prevVal = elem.value;
elem.value = 1;//Your Value
elem._valueTracker.setValue(prevVal);
let event = new Event("input", { target: elem, bubbles: true });
elem.dispatchEvent(event);
2021-11-23 12:33:43
0

พยายาม

$('#custom-input-element').click(() => console.log(clicked));

ฉันเพิ่งจะใช้เรื่องนี้ของฉันเครื่องต้องทำให้แน่ใจว่ามันได้ผลหรือให้แน่ใจว่า html ระบุตัวไม่ได้สะกดผิด

2021-11-23 06:36:11

ในภาษาอื่นๆ

หน้านี้อยู่ในภาษาอื่นๆ

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................

ดังอยู่ในนี้หมวดหมู่

ดังคำถามอยู่ในนี้หมวดหมู่