1. If you want the table to have an editable function, you can embed the input tag in the table
The function of {{list_one[1] or '}} is that when the value of list_one[1] is none, the front-end Web interface does not display none, but is displayed as empty
<Tableclass= "Table table-bordered"ID= "Parameters"> <TR> <thstyle= "width:5px">Variable name</th> <th>Variable Value</th> </TR>{% for list_one in info_list[8]%}<TR> <TD>{{list_one[0]}}</TD> <TD><inputclass= "Form-control"placeholder= "Required"value= "{{list_one[1] or '}}"></TD> </TR>{% endfor%}</Table>
2, JS How to get these values, and to pass them to flask backstage?
The following methods can be used to obtain the values of columns for each row of the table.
json.stringify (Parameters) the parameter JSON session
$ ("#save_script"). Click (function () { varParameters =NewArray (); Rows= document.getElementById ("Dubbo_parameters"). Rows; for(varrow=1;row<rows.length;row++) {Parameters[row-1] =NewArray (); for(varcol=0;col<rows[row].cells.length;col++){ if(col%2 = = 0) {Parameters[row-1][col] =rows[row].cells[col].innerhtml; }Else{Parameters[row-1][col] =rows[row].cells[col].childnodes[0 ].value; gets the value of input in TD } } } $("#dubbo_para"). Val (json.stringify (parameters)); });
3, backstage how to get the value of the front end pass over
Using Flask's Json.load method, you can turn the string from the front end into a python list
Json.loads (Request.form.get ("Dubbo_para"))
4. jquery method
<table> <tr> <td><input type= "text" value= "Out of Office" ></td> </tr></ Table>jquery:$ ("Table tr"). Children ("Td:eq (0)"). Find ("Input"). Val ();
Reference:
1, 1190000007605055
2, 6932064
JS Gets the value of table, JS gets the value of input in TD