Hey there, I've got this snippet of HTML code:
<div class='moves'>
<div class='element'><input type='text' value='55' /></div>
<input class='top' type='text' />
<input class='Bottom' type='text' />
<input class='left' type='text' />
<input class='right' type='text' />
</div>
...
I want to change the position of certain elements when a user interacts with classes top
, bottom
, left
, or right
. Here's what I attempted:
$(".top").keyup(function(){
var element = $(this).parent().closest('.element');
console.log(element);
})
However, it's not working as expected. The message I'm getting is:
w.fn.init [prevObject: w.fn.init(1)]
What I actually want is to change the position of the input with a value of 55. Any help would be greatly appreciated.