diff --git a/index.html b/index.html index 6515de21..f363d00c 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,6 @@ - + Rate your experience - -
-
- - - - - -
- -
0
-
+ + - diff --git a/project-structure.md b/project-structure.md index 1badf4af..0c09d9a3 100644 --- a/project-structure.md +++ b/project-structure.md @@ -3,9 +3,6 @@ ├── Code_of_Conduct.md ├── README.md ├── RatingStyle.css -├── auth.css -├── auth.html -├── auth.js ├── book.html ├── boy.png ├── chatbot.gif @@ -29,9 +26,14 @@ │ ├── logo2.png │ └── new-york-page.png ├── index.html +├── login.css +├── login.html +├── login.js ├── project-structure.md ├── project_structure.txt ├── script.js +├── signUp.css +├── signUp.html ├── star-rating.js └── style.css ``` diff --git a/project_structure.txt b/project_structure.txt index b57663cf..aa4aa30d 100644 --- a/project_structure.txt +++ b/project_structure.txt @@ -1,9 +1,6 @@ ├── Code_of_Conduct.md ├── README.md ├── RatingStyle.css -├── auth.css -├── auth.html -├── auth.js ├── book.html ├── boy.png ├── chatbot.gif @@ -27,8 +24,13 @@ │ ├── logo2.png │ └── new-york-page.png ├── index.html +├── login.css +├── login.html +├── login.js ├── project-structure.md ├── project_structure.txt ├── script.js +├── signUp.css +├── signUp.html ├── star-rating.js └── style.css \ No newline at end of file diff --git a/star-rating.js b/star-rating.js index e3d87750..2f613711 100644 --- a/star-rating.js +++ b/star-rating.js @@ -1,36 +1,9 @@ -document.addEventListener('DOMContentLoaded', () => { - const starContainer = document.querySelector('.star-rating'); - const stars = document.querySelectorAll('.star'); - const showValue = document.querySelector('#rating-value'); +let star = document.querySelectorAll('input'); +let showValue = document.querySelector('#rating-value'); - if (!starContainer) { - console.error('Star rating container not found'); - return; - } - - if (!stars.length) { - console.error('No star rating inputs found'); - return; - } - - if (!showValue) { - console.error('Rating value display element not found'); - return; - } - - starContainer.addEventListener('change', (event) => { - if (event.target.matches('input')) { - const selectedRating = event.target.value; - console.log('Selected rating:', selectedRating); - - showValue.textContent = `You rated this ${selectedRating} star${selectedRating !== '1' ? 's' : ''}`; - - // Update visual state of stars - stars.forEach((star) => { - star.checked = star.value <= selectedRating; - }); - } +for(let i = 0; i < star.length; i++) { + star[i].addEventListener('click', function() { + let selectedRating = this.value; + showValue.innerHTML = selectedRating; // Only show the rating value }); - - console.log('Star rating initialization complete'); -}); +} \ No newline at end of file