Add row button operational
This commit is contained in:
		| @@ -99,7 +99,7 @@ | ||||
|                                     <tr> | ||||
|                                         <td><input id="headerKeyInput" placeholder="name"></td> | ||||
|                                         <td><input id="headerValueInput" placeholder="value"></td> | ||||
|                                         <td><button class="modification-button btn-add"><i class="icon-plus"></i></button></td> | ||||
|                                         <td><button id="btn-newRow" class="modification-button btn-add"><i class="icon-plus"></i></button></td> | ||||
|                                     </tr> | ||||
|                                 </table> | ||||
|                             </div> | ||||
|   | ||||
| @@ -251,6 +251,20 @@ function addRow(key, value){ | ||||
|     headerMap.html(headersMapHtml); | ||||
| } | ||||
|  | ||||
| const newRowInput = function(){ | ||||
|     const hName = $('#headerKeyInput').val(); | ||||
|     const hValue = $('#headerValueInput').val(); | ||||
|     if(checkIfInputValid(hName) && checkIfInputValid(hValue)){ | ||||
|         addRow(hName, hValue); | ||||
|     } | ||||
| } | ||||
|  | ||||
| $('#btn-newRow').click(newRowInput); | ||||
|  | ||||
| function checkIfInputValid(input){ | ||||
|     return !(input == '' || input == null || input == undefined); | ||||
| } | ||||
|  | ||||
| function buildRowHtml(key, value){ | ||||
|     return '' +  | ||||
|     '<tr>' + | ||||
|   | ||||
| @@ -99,7 +99,7 @@ | ||||
|                                     <tr> | ||||
|                                         <td><input id="headerKeyInput" placeholder="name"></td> | ||||
|                                         <td><input id="headerValueInput" placeholder="value"></td> | ||||
|                                         <td><button class="modification-button btn-add"><i class="icon-plus"></i></button></td> | ||||
|                                         <td><button id="btn-newRow" class="modification-button btn-add"><i class="icon-plus"></i></button></td> | ||||
|                                     </tr> | ||||
|                                 </table> | ||||
|                             </div> | ||||
|   | ||||
| @@ -251,6 +251,20 @@ function addRow(key, value){ | ||||
|     headerMap.html(headersMapHtml); | ||||
| } | ||||
|  | ||||
| const newRowInput = function(){ | ||||
|     const hName = $('#headerKeyInput').val(); | ||||
|     const hValue = $('#headerValueInput').val(); | ||||
|     if(checkIfInputValid(hName) && checkIfInputValid(hValue)){ | ||||
|         addRow(hName, hValue); | ||||
|     } | ||||
| } | ||||
|  | ||||
| $('#btn-newRow').click(newRowInput); | ||||
|  | ||||
| function checkIfInputValid(input){ | ||||
|     return !(input == '' || input == null || input == undefined); | ||||
| } | ||||
|  | ||||
| function buildRowHtml(key, value){ | ||||
|     return '' +  | ||||
|     '<tr>' + | ||||
|   | ||||
		Reference in New Issue
	
	Block a user