I am developing a web application that takes letter grades like A, A-, B etc as form inputs and converts it to number grades (A == 4.0, A- == 3.7 and so on) on the backend. I cant figure out how to convert it (using JavaScript) and display the grade on the HTML. Here is my HTML code:
<td><input type="text" class="form-control" id="cs520" placeholder="letter grade"/></td>
<td><input type="text" class="form-control" id="cs550" placeholder="letter grade"/></td>
<td><input type="text" class="form-control" id="cs571" placeholder="letter grade"/></td>
<td><input type="text" class="form-control" id="cs575" placeholder="letter grade"/></td>
<td><span id="finalGPA"></span></br><input type="button" onClick=add() value="Submit"> </td>
I found something similar on this link but it seems to not solve my issue. Can someone help me with the Javascript code?