Search code examples
javascriptjqueryjquery-mobilegoogle-maps-api-3google-maps-mobile

Why is my range selector not working in my Google Maps API3 / jQuery Mobile App?


I want to vary the radius of a circle made in Google Maps API3 based on a jQuery Mobile range selector:

http://goo.gl/T1OHC

However, Chrome Web Developer keeps issuing the error "Uncaught Error: Invalid value for property : _" every time I alter my slider. Why?


Solution

  • I solved my own problem. The problem was that Google Maps API3 was parsing $(this).val() as a string, whereas an integer value was needed. To solve this issue, I replaced $(this).val() with parseInt($(this).val()).

    Here is my final javascript.

    $('input#circleRadius').change(function() {
        circle.setRadius(parseInt($(this).val()));
        });
    });