L
L
lacrim2015-11-07 19:51:43
JavaScript
lacrim, 2015-11-07 19:51:43

How to get data from DOM objects and calculate with jquery?

Hello colleagues, please give me advice or point in the right direction, I am making a slightly over-engineered calculator, and at the last stage, when all the data has already been displayed on the page, you need to get data from the elements and calculate them on the page. I have no idea how to get data from elements.

Given:

<p class="var1">300$</p>
<p class="var2">4</p>
<p class="final"></p>


It is necessary to read var1 and var2, weed out everything that is not a number from var1, multiply by var2 and display the result in final.

If mathematics is still more or less Googled, then I can’t find anything with a selection of data from elements.

Thanks for any tips in the right direction!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
riot26, 2015-11-07
@lacrim

jsfiddle.net/07cg88jt

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question