JavaScript Smart fluid javascript navigation helper

I am trying to create a javascript algorithm for an ul menu that stretches out li elements to use the available width (100%).

I was thinking about an algorithm with this flow:

1. calculate the entire available with
2. substract the total elements width to see what's left
3. iterate the elements and substract 1px from the left width and assign 
   it to the smallest li until the iterator runs out of width

Is this a good approach or will this be too laggy because it could mean a few hundred iterations?

EDIT: The comments/answers provided don't hold a good answer yet, as perhaps one or many a elements hold lengthy text and these shouldn't get any extra length. The problem needs an algoritmic solution as only the smallest element can be accounted the left over pixel after each iteration so the menu is efficiently strectched

UPDATE: For those confused this is the way I want it to stretch:

1. A bank has a total bankroll of 100 dollars
2. Jack has a 40% cut, Dennis has 6%, Minny has 1%
3. The bank starts handing out moneyz, 1 dollar each time starting with the
   poorest kid.
4. In the end Jack has 40% while Dennis and Minny have both 30%

Where the cuts stand for the number of characters in a li's child a node

Note: I have read a solution in pure css using table display but that really isn't any good as the underlying <a> elements don't seem to stretch with the parent element that way.

Answer:1

Below is the code where I am disabling ENTER button. $(document).ready(function () { $(window).keydown(function (event) { if ((event.keyCode == 13) && ($('#btnsubmit').disabled)) ...

Below is the code where I am disabling ENTER button. $(document).ready(function () { $(window).keydown(function (event) { if ((event.keyCode == 13) && ($('#btnsubmit').disabled)) ...

I want three lines of text to appear in a succession, then hide, and then appear in succession again. So far, I have been able to split the lines into span tags and appear in succession, but I can't ...

I want three lines of text to appear in a succession, then hide, and then appear in succession again. So far, I have been able to split the lines into span tags and appear in succession, but I can't ...

I have an object and a for in loop that looks like this: var golom = { MRTU03: { Temp: "10", Sp: "11" }, MRTU09: { Temp: "8", Sp: "7" } }; for (var f ...

I have an object and a for in loop that looks like this: var golom = { MRTU03: { Temp: "10", Sp: "11" }, MRTU09: { Temp: "8", Sp: "7" } }; for (var f ...

  1. object inside object javascript
  2. object inside object java
  3. object inside object python
  4. object inside object json
  5. object inside object c#
  6. object inside object php
  7. object inside object typescript
  8. object inside object swagger
  9. object inside object mongodb
  10. object inside object jquery
  11. object inside object scala
  12. object inside object json java
  13. object inside object
  14. object inside object angular
  15. object inside object react
  16. object inside object angular 2
  17. object inside object gson
  18. access object inside object javascript
  19. add object inside object javascript
  20. create object inside object javascript

I'm positive this question must have been covered before, but I can quite find it. So.... I have an object like so Object name: Fred lastname: Jones city: Los Angeles I'd like to use Javascript to ...

I'm positive this question must have been covered before, but I can quite find it. So.... I have an object like so Object name: Fred lastname: Jones city: Los Angeles I'd like to use Javascript to ...