“JavaScript di Enter Search” Kode Jawaban

JavaScript di Enter Search

<div class="box">
  <div class="container-1">
    <form id="something">
      <input name="search" placeholder="Search... type ENTER to submit or use the button -->">
      <input type="submit"> 
    </form>
    <div class="icon"  ></div>
   </div>
</div>
 Run code snippet
Jittery Jackal

JavaScript di Enter Search

<div class="box">
  <div class="container-1">
    <form id="something">
      <input name="search" placeholder="Search... type ENTER to submit or use the button -->">
      <input type="submit"> 
    </form>
    <div class="icon"  ></div>
   </div>
</div>
 Run code snippet
Jittery Jackal

JavaScript di Enter Search

function search(query){
   query.preventDefault();
   let vquery = query.target.elements["search"].value;
   console.log(vquery)
   
}

something.addEventListener("submit", search, false)
Jittery Jackal

JavaScript di Enter Search

<div class="box">
  <div class="container-1">
    <form id="something">
      <input name="search" placeholder="Search... type ENTER to submit or use the button -->">
      <input type="submit"> 
    </form>
    <div class="icon"  ></div>
   </div>
</div>
 Run code snippet
Jittery Jackal

JavaScript di Enter Search

function search(query){
   query.preventDefault();
   let vquery = query.target.elements["search"].value;
   console.log(vquery)
   
}

something.addEventListener("submit", search, false)
Jittery Jackal

Jawaban yang mirip dengan “JavaScript di Enter Search”

Pertanyaan yang mirip dengan “JavaScript di Enter Search”

Lebih banyak jawaban terkait untuk “JavaScript di Enter Search” di HTML

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya