ComeDown ComeDown -5 years ago 99
Javascript Question

Access to a value within the span tag

I'm trying to modify this range slider.
Since I have to incorporate this slider in another file I need to understand how it works.
In particular I would like to know where the code returns the selected year.

I tried adding these prints but it doesn't print the correct year.

var rangeSlider = function() {
var slider = $('.range-slider');
var range = $('.range-slider__range');
var value = $('.range-slider__value');

// added print

slider.each(function() {
value.each(function() {
var value = $(this).prev().attr('value');

// added print

range.on('input', function() {


Looking on Chrome, I see that the value being edited is in
enter image description here
I can't access to that value. How can I do that?


Answer Source

The content of an element can be accessed using text() method. For example:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download