Bootstrap 3 compatibilty
Use .val()
Ignore if max<=0
Automatic warp
Remove duplicate calculation