10
I’m having a huge doubt.
I need to take the values that are in the database with decimals of 3 (for example: 56826.497) and show on the screen the value 56.826,497. I’ve tried using the maskMoney and the priceformat, but they didn’t work out.
The maskMoney even serves to insert the values correctly, forcing me to insert only numbers and the way I format (56,826,497). However, when it loads the value of the database to view on the screen, it appears as 56826,497. detail: I am loading the values like this:
In HTML I am 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>
thank you very much. helped a lot
– gustavo amaral
Possible duplicate: http://answall.com/questions/11018/howto represent money
– Sergio