A
A
Alexey Nikolaev2015-11-09 17:11:21
JavaScript
Alexey Nikolaev, 2015-11-09 17:11:21

How to display the result of dividing the value of one block by another?

<div class="weight">0.7</div>
<div class="price"><span>1800</span> руб.</div>

<div class="finish">2571.42</div>
here we should get a number equal to (.price / .weight)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2015-11-09
@megrel90

css

.price::after,  .finish::after{
    content: " руб."
}

HTML
<div class="weight"><span>0.7</span></div>
<div class="price"><span>1800</span></div>
<div class="finish"></div>

javascript
var price = $('.price span').text()-0;
var weight = $('.weight span').text()-0;
$('.finish').text(price/weight);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question