I am trying to get a JQuery function to update a Canvas element via a range form element.
The Jquery function I have written looks like this:
$(document).ready(function() {
$("changing").change(function() {
var Radius = $(this).val();
circle(Radius);
});
});
The form looks like this:
<input id="changing" name="changing" type="range" min="0" max="500" step="5" value="150" onchange="changing(this.val)" />
I am all new to writing functions, so I am pretty sure I am missing a step or doing something rather obvious wrong. Anyone care to correct me? If there are links you would recommend me reading, please toss them my way.
Oh, and in my canvas I have:
ctx.arc(250, 250, Radius, 0, Math.PI*2);
Where Radius is the value to be updated from the slider moving around.
Try:
$("#changing").change(function() {The # denotes that you’re referring to an ID which is basically what you’re trying to access.
$(“changing”) would mean you’re trying to access a tag type ‘changing’.