Simple Counter Javascript

Today I’m working on making a simple counter with HTML / CSS and JS. My javascript isn’t working and I don’t know why.. I read a lot on the internet and tried to add "async" but it seems that my code needs a review let counter = document.getElementById(‘counter’); let increaseButton = document.getElementById(‘increase’); let decreaseButton =… Read More Simple Counter Javascript

Remove all the empty anchor tags if target address in not provided and innerText prensents

I’m getting HTML template response from API service, in that sometimes I’m getting link and its href value is empty string(but innerText has some value), Can anyone help me how can I hide the anchor tag if only text is present and href is empty. Sometimes HTML response provides multiple empty links, give solution to… Read More Remove all the empty anchor tags if target address in not provided and innerText prensents

How do i change the backgroundcolor of a form element when clicked?

I’ve been trying to figure out how I can change the background color of a form element when it is clicked on. Heres the code: <form id="form"> <input type="text" placeholder="text"/> <input type="password" placeholder="more text" /> </form> <script> </script> I’m trying to make it so the form element where it says "text" turns green when clicked,… Read More How do i change the backgroundcolor of a form element when clicked?

today.getDate works on other days except on Sunday

Example of this code that works normally at a specified date, which is a Saturday. weeks=[“Monday”,”Tuesday”,”Wednesday”,”Thursday”,”Friday”,”Saturday”,”Sunday”]; var today = new Date(“September 24, 2022 01:15:00”); document.getElementById(“current-day”).innerHTML=weeks[today.getDay()-1]; <h1 id=”current-day”></h1> As stated in my title above, this code works on other days except only on Sundays, it just says Undefined, why is that? weeks=[“Monday”,”Tuesday”,”Wednesday”,”Thursday”,”Friday”,”Saturday”,”Sunday”]; var today = new… Read More today.getDate works on other days except on Sunday

Show data from form into automated table using JS/Html

I have a basic table inside of a form but the function addData doesn’t seem to run when I click the Add button. Any suggestions? I am trying to make an automatic table to keep track of the needed information. document.getElementById(‘DateField’).valueAsDate = new Date(); function addData() { var store_price = document.getElementById(“price”); var store_moneyback = document.getElementById(“moneyback”);… Read More Show data from form into automated table using JS/Html