I should add rows to the table with jQuery:
<table class="table">
<tbody id="dh-values">
</tbody>
</table>
I've written the following code:
function displayHash(fieldName) {
$('#dh-values').append('<tr></tr>').append('<td id="dh-'+fieldName+'">'+$('#'+fieldName).val()+'</td>').append('<td id="dh-'+fieldName+'-h">'+hex_sha1($('#'+fieldName).val())+'</td>');
};
But it looks awful. Is there any way to simplify that?
tds totbody.append()call. You can build the entire string of<tr><td></td><td></td></tr>and append it once. It isn't necessarily prettier though.<tbody><tr><td></td><td></td></tr></tbody>