Tag calculate percentage in javascript example