I'm trying to move an image holder div to specific x and y coordinates after input from two separate text field inputs have been changed. Below is the code for just the x coordinate.
Here is a jfiddle here
var img1x;
var img1y;
var img1position;
img1position = $( "#img1" ).position();
img1x = img1position.left;
img1y = img1position.top;
I've tried this and it only moves the div if the imput value is "0". it won't move for anything else:
$("#img1x").change(function() {
//alert("img1x: " +img1x);
$( "#img1" ).css('left', $( "#img1x" ).val());
});
and I've tried this and it does nothing.
$("#img1x").change(function() {
img1x = $( "#img1x" ).val();
//alert("img1x: " +img1x);
$( "#img1" ).css('left', img1x);
});
pxin the end