2
In the following case, you have a code being entered in the attribute data-produto
of my input.
$(".valor.partida").bind('blur', function(){
alert($(this).data("produto"));
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<input class="valor partida" type="text" name="novo_valor_partida-1" value="11,11" data-produto="0101000" data-id="1">
The problem is that when obtaining the value of this attribute, it returns without the initial zero, only 101000
.
Why does this happen?
This way it is working correctly but what would be the problem with the
data
? He does some conversion or black magic?– Marcelo de Andrade
@Marcelodeandrade http://answall.com/questions/50349/jquery-n%C3%a3o-usa-o-dataset-do-Html5-no-data
– bfavaretto
+1 @bfavaretto for clarification
– Marcelo de Andrade
@Marcelodeandrade joined the answer. He treats as
Number
, that was however corrected in later versions.– Sergio
I was just waiting for the team to accept your answer, @Sergio. It was enough to clear the doubts.
– Marcelo de Andrade
@bfavaretto this your answer is very good. Linkei. You can not double up :P
– Sergio