Skip to content

Commit

Permalink
Use textContent instead of hard code in html
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammadflht committed Mar 7, 2024
1 parent a0e0d82 commit 85b192a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,14 @@ confirmButton.addEventListener('click', function() {
}
if ((inputMonth.value.length === 0) || (inputYear.value.length === 0)) {
mounthYearError.style.display = "block";
mounthYearError.textContent = "Can't be blank";
isError = true;
}else {
mounthYearError.style.display = "none";
}
if (inputCVC.value.length === 0) {
cardCvcError.style.display = "block";
cardCvcError.textContent = "Can't be blank";
isError = true;
}else {
cardCvcError.style.display = "none";
Expand Down
7 changes: 3 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,17 @@
<section class="form-main">
<div class=" form-base"><label for="#">CARDHOLDER NAME</label><input id="cardholder" type="text" placeholder="e.g. Jane Appleseed" maxlength="30"></div>
<div class=" form-base"><label for="#">CARD NUMBER</label><input id="card-number" type="text" placeholder="e.g.1234 5678 9123 0000" maxlength="19">
<p class="errorMessage" id="cardNumberFormatError">Wrong format, number only</p>
<p class="errorMessage" id="cardNumberEmptyError">Can't be blank</p>
<p class="errorMessage" id="cardNumberError"></p>
</div>
<div class="namedate-part">
<div class="namedate-part-left">
<div><label for="#">EXP. DATE</label><input type="text" placeholder="MM" maxlength="2">
<p class="errorMessage" id="mounthYearError">Can't be blank</p>
<p class="errorMessage" id="mounthYearError"></p>
</div>
<div><label for="#">(MM/YY)</label><input type="text" placeholder="YY" maxlength="2"></div>
</div>
<div class="namedate-part-right"><label for="#">CVC</label><input type="text" placeholder="e.g. 123" maxlength="3">
<p class="errorMessage" id="cardCvcError">Can't be blank</p>
<p class="errorMessage" id="cardCvcError"></p>
</div>
</div>
<div class="button" id="confirmButton"><button>Confirm</button></div>
Expand Down

0 comments on commit 85b192a

Please sign in to comment.