I have a huge doubt.
I need to get the values that are in the database with decimal places of 3 (for example: 56826.497) and display 56,826,497 on the screen. I already tried using maskMoney and priceformat , but they did not work.
maskMoney even serves to insert values correctly, forcing me to only enter numbers and the way I format (56,826,497). However, at the time it loads the value of the database to display on the screen, it appears as 56826.497. detail: I'm loading the values like this:
In HTML I'm using the code below:
//----------------------------------------------------------------- no cabeçalho
* <script src="../scripts/js/jquery.maskMoney.min.js"></script>
//------------------------------------------------------------------ no cabeçalho
* <script>
$(function(){
$('#commod_com_imp, #serv_com_imp, #commod_sem_imp, #serv_sem_imp').maskMoney({ thousands: '.', decimal: ',' });
});
//------------------------------------------------------------------ no momento de carregar a página
function preenche_primeira_vez() { // Preenchimento na primeira vez
indice_bd=0;
get_num_registros();
$("input").prop('disabled',true); // Colocando todos os campos como desabilitado
$("select").prop('disabled',true); // Colocando todos os campos como desabilitado
$.ajax({
type: "GET",
url: "../funcoes.php",
data:{acao:"consulta_preco", offset:indice_bd, numlinhas:1, nome_tabela:'cliente,preco'},
success:function(resp_consulta) {
consulta_formatada = $.parseJSON(resp_consulta);
$("input[name=commodity_com_imp]").val(consulta_formatada[0].commodity_com_imp.replace("." , ","));
//------------------------------------------------------------------ no body
<div class="texto_e_valor_com_3">
<div class="texto">Preço commodity com imposto (R$/m<sup>3</sup>)</div>
<div class="valor"><input type="text" MAXLENGTH="10" name="commodity_com_imp" id="commod_com_imp"/></div>