I think the method you are looking for is closest

On Jan 28, 12:39 pm, kgosser <kgos...@gmail.com> wrote:
> Hello, pretty noob question here. I have this example:
>
> <div>
>    <form>
>       <div>
>           <label>Example</label>
>           <input type="text"/>
>       </div>
>    </form>
> </div>
>
> Now let's say there's this jQuery:
>
> $("input").click(function(){
>    $(this).parent("form").css("color","#F00");
>
> });
>
> My question: Does the parent() method work like that, or do I need to
> do something like $(this).prev().prev() to get to the form? I guess
> I'm trying to better understand how flexible the parent() and children
> () methods are.
>
> Thanks in advance.

Reply via email to