0
How do I get property values data-pedido
and data-id
with jquery?
<h5 class="titulo-resumo pedido" data-pedido="v583161rhp" data-id="01">Pedido</h5>
0
How do I get property values data-pedido
and data-id
with jquery?
<h5 class="titulo-resumo pedido" data-pedido="v583161rhp" data-id="01">Pedido</h5>
1
You can use the api .data()
. This Jquery api selects the value of any attribute data-*
in this case, a h5
.
console.log($( "h5" ).data( "pedido" ));
console.log($( "h5" ).data( "id" ));
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<h5 class="titulo-resumo pedido" data-pedido="v583161rhp" data-id="01">Pedido</h5>
Browser other questions tagged jquery
You are not signed in. Login or sign up in order to post.