Skip to content

Commit

Permalink
Merge pull request #765 from Srikar-1729/feedback_emoji_not_selected_msg
Browse files Browse the repository at this point in the history
Feedback form emoji not selected msg added in ui
  • Loading branch information
PriyaGhosal authored Oct 20, 2024
2 parents 6915f8d + 1a6506d commit c564068
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ document.getElementById('closeModal').onclick = function() {

document.getElementById('nextToFeedback').onclick = function() {
const selectedEmoji = document.querySelector('.emoji.selected');
if (!selectedEmoji) {
alert('Please select an emotion!');
if (!selectedEmoji) {
document.getElementsByClassName('emojis')[0].style.margin="0 0 20px 0";
document.getElementById('emoji-not-selected').removeAttribute("hidden");
return;
}
}
selectedEmotion = selectedEmoji.dataset.value;
document.getElementById('step1').style.display = 'none';
document.getElementById('step2').style.display = 'block';
Expand All @@ -105,6 +106,9 @@ document.querySelectorAll('.emoji').forEach(emoji => {
emoji.onclick = function() {
document.querySelectorAll('.emoji').forEach(e => e.classList.remove('selected'));
emoji.classList.add('selected');
document.getElementById('emoji-not-selected').hidden= true;
document.getElementsByClassName('emojis')[0].style.margin="20px 0";

}
});

Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ <h2>We Value Your Feedback</h2>
<!-- Step 1: Emoji Selection -->
<div class="step" id="step1">
<h3>How do you feel?</h3>

<p id="emoji-not-selected" hidden="true">Please select an emotion!</p>
<div class="emojis">
<div class="emoji-option">
<span class="emoji" data-value="happy">😄</span>
Expand Down

0 comments on commit c564068

Please sign in to comment.