Continuing on from: https://stackoverflow.com/questions/16649933/jquery-on-form-change-with-bootstrap-sliders/16650319?noredirect=1
I am currently using the below to cap
The reason this doesn't work is because JavaScript conforms with the HTML specification, and the HTML specification states that ID attributes must be unique.
You aren't allowed to have two elements with id="price"
. Because of this JavaScript will stop searching after it has found the first match. Your .each()
loop will only go around once, regardless of how many #price
elements are present after the first.
To resolve this, use classes instead. For example:
<div class="price">...</div>
<div class="price">...</div>
<div class="price">...</div>
$('.price').each(function(index,value) { ... });
You will also need to change your #log
elements to use classes, too.
$('#price')
is id, page include one duplicate id. you need use class