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
Post a Comment