javascript - How to find data from html and store it using jQuery -


my html

<div class="product">  <img src="#">   <div class="pricestore">    <p data="40">item 1</p>  </div> </div> 

how, using jquery retrieve data , store it?

my attempt:

$('.product').mousedown(function(event) {     var x = $('.pricestore').parent().find(data);     console.log(x); }); 

thanks!

there few different ways write selector value of attribute can use .attr()

something works case

$('.product').mousedown(function(event) {     var x = $('.pricestore p').attr('data');     console.log(x); }); 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -