Assigning variable to object at children.eq(0)

Assigning variable to object at children.eq(0)

Hello all

I am trying to assign a variable to a jquery object that is found using the children() and eq() methods. This is a simplified version of the html structure.
  1. <div>
  2. <a href = '#' class = 'link'>Link </a>
  3. <input type = 'button' id = 'button' / >
  4. </div>
Here is the jquery code. All I want to do is assign an object to the variable and be able to manipulate the object through the variable.

  1. $("#button").click(function(){
  2. var link = $(this).parent().children(".link").eq(0);
  3. //Do things with the anchor
  4. });
Again this is a simplified version of my code but the structure is similar. Could anyone tell me what I am missing here? Thanks much, I appreciated it.