This is a bit of a practice project in my javascript class, and I am a bit stuck at the moment with the last part.

The purpose of the project is that you input a whole number for meters and it will convert it to feet and inches. The inches will be a mix of whole number and fractions.
The fractions being used are : 1/32 , 1/16, 1/8, 1/4, 1/2.

So when you put a number in, it should output something like this:

8 Meters = 26'2.03/32"

I am starting to get the fraction down correctly. I can easily get it to display 32, however, if it simplifies, it should reduce downwards. And then I end up with a leading 0 before the fraction as well. I'm right near the end, but I've been here for well over a week now and I have no idea what I am doing for the most part. If anyone has any tips of advice, I'm willing to try them!

WARNING: Messy code ahead(?) I'm still a beginner so I'm not exactly used to knowing how to make a clean code.


Html that goes with the Javascript: