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.
- <div>
- <a href = '#' class = 'link'>Link </a>
- <input type = 'button' id = 'button' / >
- </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.
- $("#button").click(function(){
- var link = $(this).parent().children(".link").eq(0);
- //Do things with the anchor
- });
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.