我是 javascript 新手,我正在嘗試創建以下內容:
我有一個航班搜索表單,在用戶單擊“搜索”后,用戶會立即獲得結果。
我想改變這個程序。當用戶填寫搜索表單并單擊“搜索”時,我希望彈出螢屏顯示帶有“我理解”按鈕的條款和條件。僅當用戶單擊 POPUP 中的“我明白”按鈕時,才會顯示搜索結果。
我正在嘗試使用 await 和 async 但我仍然沒有成功..
下面是主要代碼:
export function initSearchButtonOnClick() {
$("#search-button").on("click", function (e) {
activateLoadingOverlay2() // POPUP window Tearms & Condition
// the code down needs to happen only after the user click the button "I understand" in the POPUP window.
console.log("blerdii");
e.preventDefault();
switch (flightType) {
case "rt":
case "ow":
if (
$("#from-destination")[0].reportValidity() &&
$("#to-destination")[0].reportValidity()
) {
const fromDestination = $("#from-destination")
.val()
More code below
uj5u.com熱心網友回復:
javascript 是異步和單執行緒的。忘記await和async。
從您的彈出 HTML 模板中,您必須在用戶單擊“我理解”按鈕時系結一個函式。那一切。
您的函式activateLoadingOverlay2()應該注冊“我理解”按鈕的事件偵聽器來執行您想要的操作。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/346270.html
標籤:javascript html 查询
上一篇:在Nodejs中允許跨域
下一篇:如何在map()回圈內回圈?
