8
In a <input>
, have the following value:
00001545455
When I recover the same with Javascript, he comes without the first 4 zeros.
Can someone help me?
I am already passing it in the function I am using. The problem is that when it arrives in the function comes without the zeros:
<a class="btnGrid bt_consulta btsAcoes" titulo="Consultar" href="javascript:;" onclick="GVScheduleCommand('gvClientes',['Consultar',3],1,[{ 'name': 'cd_cnpj_cpf', 'value': 00001545455 }], 'CPF_CNPJ' );"></a>
How are you recovering that value?
– stderr
You have to put in the code you’re using, or I can’t guess. Take a look here -> https://jsfiddle.net/h565yvmr/ something in your code is doing
parse
thatvalue
– Sergio
First, edit your question with the code. Don’t post it in the comments. Second, you are passing the number as a number in Json, not as a numeric string. Therefore, there is no way to recover these 0 left unless you know what the size of your field, and then padding 0’s left manually.
– Vinícius Gobbo A. de Oliveira
Here is working ok
– felipsmartins
Pass number as string must resolve:
{ 'name': 'cd_cnpj_cpf', 'value': '00001545455' }
, there is no number with zeros in front, to keep the zeros, you should leave it as string.– Ivan Ferrer