Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

How do I use JS/JQ on button to get value from an element which is in the parent div of the button?

$
0
0

I'm trying to create a pseudo e-commerce website for my end-semester project and I've been wondering the logic behind it.

I want a button to get the value of an element(price of an item), which is in the parent div and I want it to get it from only it's own parent div, not others.

I don't need the entire code, just how do I go about it? Do I use (this).parent('#product.price').value(probably not correct syntax but you get the idea) ?

Thank you.


Viewing all articles
Browse latest Browse all 138163

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>