Skip to content

Commit

Permalink
Update frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
lehuutrung1412 committed Jul 20, 2021
1 parent f8ece7b commit 14bbc40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/static/js/script.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
const question_input = document.getElementsByClassName("question-input")[0];
const answer = document.getElementsByClassName("ans")[0];
const textans = document.getElementsByClassName("textans")[0];
const answer_ = document.getElementsByClassName("answer")[0];

question_input.addEventListener("keyup", function(event) {
if (event.key === "Enter") {
console.log(question_input.value);
answer_.style.visibility = "hidden";
textans.style.visibility = "hidden";
if (question_input.value === ''){
alert('Vui lòng nhập câu hỏi!');
}
Expand Down Expand Up @@ -36,6 +39,8 @@ function upload(){
text = text.slice(0, start) + "<strong>" + text.slice(start, end) + "</strong>" + text.slice(end, text.lenght);
answer.value = ans;
textans.innerHTML = text;
answer_.style.visibility = "visible";
textans.style.visibility = "visible";
}
else{
console.log('No response');
Expand Down
4 changes: 2 additions & 2 deletions app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ <h6 >Based on Bert</h6>
<span class="input-group-text" id="inputGroup-sizing-default">Question</span>
<input type="text" class="question-input form-control" placeholder='Who is the founder of Google?' aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
</div>
<div class="answer input-group mb-3">
<div class="answer input-group mb-3" style="visibility: hidden;">
<span class="input-group-text" id="inputGroup-sizing-default">Answer</span>
<input type="text" readonly class="ans form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
</div>
<div class="form-group">
<p class="textans form-control" readonly id="exampleFormControlTextarea1" rows="3"></p>
<p class="textans form-control" style="visibility: hidden;" readonly id="exampleFormControlTextarea1" rows="3"></p>
</div>
</main>
<footer>
Expand Down

0 comments on commit 14bbc40

Please sign in to comment.