Home > Software engineering >  How to make HTML Table accept integers with comma and dot separators
How to make HTML Table accept integers with comma and dot separators

Time:08-31

How can I make <td>-s in HTML Table accept integers with comma and dot separators?

function getOrderProductInfo() {
  var table = $("#edit_print_costs_table_body");
  var year = parseInt($("#existing_seasons_input_field").val(), 10);
  var season = $("#existing_seasons_input").val();
  $.get("@(Url.Action("
    GetOrderProduktInfo ", "
    MaillingOrder "))"   '?year='   year   '&season='   season,
    function(resp) {
      var result = resp.Value;
      if (result.length > 0) {
        table.html("");
        result.forEach(function(v) {
          table.append("<tr id = '"   v.ID   "'><td>"   v.Amount   "</td ><td> "   v.PricePerUnit   "</td ><td>"   v.TotalPrice   "</td><td><button class='editButtonProduct'>edit</button></td> <td><button class='deleteButtonProduct'>Delete</button></td></tr > ");
        });
      } else {

      }
    });
}

CodePudding user response:

Well, a table in html can contain a lot of things, especially (integer) numbers. Depending on local customs, the symbol (.) or (,) is used to denote something different (decimals or separate thousands). Regardless:

<table>
  <tr>
    <td>3.14</td>
    <td>3,14</td>
    <td>300.124,124</td>
  </tr> 
</table>

Should all work just fine! This just a guess though, since your question was not that clear on the circumstances you are working under.

CodePudding user response:

I guess that's impossible. If it contains a comma or dot that means it isn't an integer.

  • Related