wrap with form

This commit is contained in:
techgaun 2017-03-30 13:17:39 -05:00
parent 8584e894d4
commit 8e17912802
No known key found for this signature in database
GPG key ID: 57FB3143221F7B30
2 changed files with 13 additions and 6 deletions

View file

@ -15,12 +15,14 @@
</div> </div>
<div class="panel-body"> <div class="panel-body">
<div class="input-group"> <form id="form" class="form-horizontal" role="form">
<input id="repo" class="form-control" type="text" placeholder="techgaun/github-dorks"> <div class="input-group">
<span class="input-group-btn"> <input id="repo" class="form-control" type="text" placeholder="techgaun/github-dorks">
<button onClick="fetchData()" type="button" class="btn btn-primary">Find</button> <span class="input-group-btn">
</span> <button onClick="fetchData()" type="button" class="btn btn-primary">Find</button>
</div> </span>
</div>
</form>
<div id='data-body' class=""> <div id='data-body' class="">
</div> </div>

View file

@ -1,3 +1,8 @@
document.getElementById('form').addEventListener('submit', (e) => {
e.preventDefault()
fetchData()
})
function fetchData() { function fetchData() {
const repo = document.getElementById('repo').value const repo = document.getElementById('repo').value
const re = /[-_\w]+\/[-_.\w]+/ const re = /[-_\w]+\/[-_.\w]+/