JavaScript How to add and remove new elements such as list, input box and option selection in javascript

I'm trying to create a webview app with jquery that calculate GPA and I've created two buttons one of them for adding new elements and the other one to remove the elements and I'm trying to add more than one element at the same time such as the module name, credits input and the option selection also I'm wondering if there is a way to increment the module number for example there will be 5 modules as default and the last module called Module 5 so when I click add button the name should be changed to Module 6.

Edit:- I've add my java script that I am working on it based on this code:-

http://jsfiddle.net/jaredwilli/tzpg4/4/

$(window).on('pageinit', function() {
$(document).ready(function(){
  $("#Sadd").click(function() {
	  var test = $('Sc5');
        var i = $('#Sc5').size() + 1;
       
$('<li data-role="fieldcontain" style="border:none"><label for="Sc5">Credits:</label><input type="number" id="Sc5"  name="Sc5_' + i +'" value="" data-clear-btn="true"></li>').appendTo(test);
                i++;
                return false;	
  
    });
  });
 });
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CCE GPA Calculator</title>
<meta name="viewport" content="initial-scale=.80; maximum-scale=.80; minimum-scale=.80;" />
<link rel="stylesheet" type="text/css" target='_blank' href="css/HideSpiner.css"/>
<link rel="stylesheet" type="text/css" target='_blank' href="css/jquery.mobile.flatui.css" />
<script src="js/jquery.js"></script>
<script src="js/jquery.mobile-1.4.0-rc.1.js"></script>
</head>

<body>
<div data-role="page" id="GPA1"> 
  <script type="text/javascript" src="js/benggpacalc.js"></script>
  <script type="text/javascript" src="js/test.js"></script> 
  <div data-role="header" data-theme="f"> <a data-iconpos="notext" data-transition="pop" data-direction="reverse" data-role="button" data-icon="home" title="Home" target='_blank' href="index.html">Home</a>
    <h1>BENG & BSc</h1>
  </div>
  <form id="form">
    <ul data-role="listview" data-inset="true">
      <li style="border:none">
        <h1>Module 1:</h1>
      </li>
      <li data-role="fieldcontain" style="border:none">
        <label for="Sc1">Credits:</label>
        <input type="number" step="0.01" name="Sc1" id="Sc1" value="" data-clear-btn="true">
      </li>
      <li data-role="fieldcontain" style="border:none">
        <label for="Sgrade1" class="select">Grade:</label>
        <select class="Sgrade1" data-theme="f" id="Sgrade1">
          <option value="-1">—</option>
          <option value="4">A</option>
          <option value="3.7">A-</option>
          <option value="3.3">B+</option>
          <option value="3">B</option>
          <option value="2.7">B-</option>
          <option value="2.3">C+</option>
          <option value="2">C</option>
          <option value="1.7">C-</option>
          <option value="1.3">D+</option>
          <option value="1">D</option
>
          <option value="0">F</option>
        </select>
      </li>
      <li style="border:none">
        <h1>Module 2:</h1>
      </li>
      <li data-role="fieldcontain" style="border:none">
        <label for="Sc2">Credits:</label>
        <input type="number" step="0.01" name="Sc2" id="Sc2" value="" data-clear-btn="true">
      </li>
      <li data-role="fieldcontain" style="border:none">
        <label for="Sgrade2" class="select">Grade:</label>
        <select class="Sgrade2" data-theme="f" id="Sgrade2">
          <option value="-1">—</option>
          <option value="4">A</option>
          <option value="3.7">A-</option>
          <option value="3.3">B+</option>
          <option value="3">B</option>
          <option value="2.7">B-</option>
          <option value="2.3">C+</option>
          <option value="2">C</option>
          <option value="1.7">C-</option>
          <option value="1.3">D+</option>
          <option value="1">D</option>
          <option value="0">F</option>
        </select>
      </li>
      <li style="border:none">
        <h1>Module 3:</h1>
      </li>
      <li data-role="fieldcontain" style="border:none">
        <label for="Sc3">Credits:</label>
        <input type="number" step="0.01" name="Sc3" id="Sc3" value="" data-clear-btn="true">
      </li>
      <li data-role="fieldcontain" style="border:none">
        <label for="Sgrade3" class="select">Grade:</label>
        <select class="Sgrade3" data-theme="f" id="Sgrade3">
          <option value="-1">—</option>
          <option value="4">A</option>
          <option value="3.7">A-</option>
          <option value="3.3">B+</option>
          <option value="3">B</option>
          <option value="2.7">B-</option>
          <option value="2.3">C+</option>
          <option value="2">C</option>
          <option value="1.7">C-</option>
          <option value="1.3">D+</option>
          <option value="1">D</option>
          <option value="0">F</option>
        </select>
      </li>
      <li style="border:none">
        <h1>Module 4:</h1>
      </li>
      <li data-role="fieldcontain" style="border:none">
        <label for="Sc4">Credits:</label>
        <input type="number" step="0.01" name="Sc4" id="Sc4" value="" data-clear-btn="true">
      </li>
      <li data-role="fieldcontain" style="border:none">
        <label for="Sgrade4" class="select">Grade:</label>
        <select class="Sgrade4" data-theme="f" id="Sgrade4">
          <option value="-1">—</option>
          <option value="4">A</option>
          <option value="3.7">A-</option>
          <option value="3.3">B+</option>
          <option value="3">B</option>
          <option value="2.7">B-</option>
          <option value="2.3">C+</option>
          <option value="2">C</option>
          <option value="1.7">C-</option>
          <option value="1.3">D+</option>
          <option value="1">D</option>
          <option value="0">F</option>
        </select>
      </li>
      <li style="border:none">
        <h1>Module 5:</h1>
      </li>
      <li data-role="fieldcontain" style="border:none">
        <label for="Sc5">Credits:</label>
        <input type="number" step="0.01" name="Sc5" id="Sc5" value="" data-clear-btn="true">
      </li>
      <li data-role="fieldcontain" style="border:none">
        <label for="Sgrade5" class="select">Grade:</label>
        <select class="Sgrade5" data-theme="f" id="Sgrade5">
          <option value="-1">—</option>
          <option value="4">A</option>
          <option value="3.7">A-</option>
          <option value="3.3">B+</option>
          <option value="3">B</option>
          <option value="2.7">B-</option>
          <option value="2.3">C+</option>
          <option value="2">C</option>
          <option value="1.7">C-</option>
          <option value="1.3">D+</option>
          <option value="1">D</option>
          <option value="0">F</option>
        </select>
      </li>
      <li class="ui-body ui-body-b" style="border:none">
        <fieldset class="ui-grid-a">
          <div>
            <button type="button" id="Sadd" name="Sadd" data-theme="f">Add Module</button>
          </div>
        </fieldset>
      </li>
      <li class="ui-body ui-body-b" style="border:none">
        <fieldset class="ui-grid-a">
          <div>
            <button type="button" id="Sremove" name="Sremove" data-theme="f">Remove Module</button>
          </div>
        </fieldset>
      <li data-role="fieldcontain" style="border:none">
        <label for="Sres">Your GPA:</label>
        <input type="number" step="0.01" name="Sres" id="Sres" value="" data-clear-btn="true" readonly>
      </li>
      </li>
      <li class="ui-body ui-body-b" style="border:none">
        <fieldset class="ui-grid-a">
          <div>
            <button type="button" id="Scal" name="Scal" data-theme="f">Calculate</button>
          </div>
        </fieldset>
      </li>
      <li class="ui-body ui-body-b" style="border:none">
        <fieldset class="ui-grid-a">
          <div>
            <button type="reset" data-theme="d">Reset</button>
          </div>
        </fieldset>
      </li>
    </ul>
  </form>
</div>
</body>
</html>
Answer:1

Consider this code. It is a gross simplification of the program I am writing. let numberOne; let numberTwo; function assignNumbers() { numberOne = Math.random()*10 numberTwo = Math.random()*10 } ...

Consider this code. It is a gross simplification of the program I am writing. let numberOne; let numberTwo; function assignNumbers() { numberOne = Math.random()*10 numberTwo = Math.random()*10 } ...

I have a table in my html document that is styled with css. When I hard code the table rows and cells in html, the styling is working as desired. For example when I hover the mouse over a row, the ...

I have a table in my html document that is styled with css. When I hard code the table rows and cells in html, the styling is working as desired. For example when I hover the mouse over a row, the ...

I have the following array: let arr = [ {"id": 123, "lastUpdate": 1543229793}, {"id": 456, "lastUpdate": 1545269320}, {"id": 123, "lastUpdate": 1552184795} ] I need to filter the array ...

I have the following array: let arr = [ {"id": 123, "lastUpdate": 1543229793}, {"id": 456, "lastUpdate": 1545269320}, {"id": 123, "lastUpdate": 1552184795} ] I need to filter the array ...

  1. filter unique objects in array javascript
  2. filter unique objects in array
  3. filter unique objects js
  4. filter unique objects javascript
  5. filter unique objects
  6. filter unique objects in array js
  7. javascript filter unique objects by property
  8. typescript filter unique objects
  9. django filter unique objects
  10. filter out unique objects in array javascript
  11. js filter unique objects in array

Is there anyway to stream an audio file without giving complete path of the file. For example whenever we tried to play mp3 file with HTML5 Audio tag or With javascript, then i have to supply ...

Is there anyway to stream an audio file without giving complete path of the file. For example whenever we tried to play mp3 file with HTML5 Audio tag or With javascript, then i have to supply ...

  1. stream audio files
  2. stream audio files php
  3. stream audio files on ipad
  4. microsoft stream audio files
  5. stream wav audio files
  6. stream audio/video files
  7. vlc stream audio files
  8. gta sa audio stream files
  9. stream audio files dropbox