Switch to regular for loop.

Use $.val() instead of .value.