Skip to content

javascript percentage rounding

I have a value of 0.9019497053624151. It needs to display 90, so it is ideal to use the ff formula? by the way this is a percentage I tried rounding it off to 1 decimal place and then * 100, should I round it to 1 or 2 decimal places? What do you call this percentage rounding? That from a

Setting a limit for checkbox in js

I’m trying to make a form that sets a limit for 3 selection max or 1 minimum for my checkbox. I do get the error message once the condition isn’t set but I still can check them. How can I prevent that? and how can I prevent it from submitting the form when it happens? This is my JavaScript code

Hide elements the correct way

I’m using JavaScript to hide and show some elements onclick events Using this code I don’t think this is the correct way! ? specially if I have a very large page with a lot of tabs and elements ? Thank you Answer You could add a class on all the element that can be hidden (I assume you are handlin…

Count matching letters once

I’m creating a kid’s learning tool that has a form which matches 4 letters to a word. I want to count the number of character matches in a word. But it counts duplicates of letters as 2 instead of 1. For example if the word is “loot”, and the user submits “flop”, the matchi…