Try using parents(...) instead of parent(...), or parent().parent().
(.fieldRow is not the immediate parent of the input field)

[I'm not entirely sure that using toggleClass() on a focus event will
give you the intended result, but still ... ]

On Nov 7, 4:02 am, dan <[EMAIL PROTECTED]> wrote:
> I may be missing something here but the following code doesn't work.
> As you focus the input to outter div gets toggles a class name.
>
> Please help.
>
> <script>
> $(function() {
>          $('.fieldRow input').focus(function(){
>                 $(this).parent('.fieldRow').toggleClass("focused");
>          });});
>
> </script>
> <form action="" method="" id="">
>         <div class="fieldRow">
>                 <label for="author">Name:*</label>
>                 <span class="input">
>                         <input type="text" name="author" id="author" value="" 
> size="22"
> tabindex="1" />
>                 </span>
>         </div>
> </form>

Reply via email to