Reply
Mon 8 Jul, 2013 06:43 pm
I am tying to use a jquery slider to plot a line on a canvas when I click a button. I dont know how and where to make the value from the slider a variable that changes with the slider, it just stays with the initial slider value.
$(function() {
$( "#slider" ).slider({
value:100,
min: 0,
max: 500,
step: 50,
slide: function( event, ui ) {
$( "#amount" ).val( "$" + ui.value );
}
});
$( "#amount" ).val( "$" + $( "#slider" ).slider( "value" ) );
a=$( "#slider" ).slider( "value" );
});
</script>
</head>
<body>
<script>
function myFunction()
{
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.moveTo(a,50);
ctx.lineTo(b,0);
ctx.stroke();
}