Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.5a is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorjibegod
    • CommentTimeJun 10th 2007
     permalink
    New to Javascript and I'm trying to accomplish this.. I'm wrapping text input and submit button form elements inside a div. When either the text field or the submit button gain focus, I want to swap the class on the parent div. The form elements themselves wouldn't change, but the wrapper div would, for example, gain and lose a border depending on whether any of its contents had focus.

    Any suggestions?
    • CommentAuthorvarland
    • CommentTimeJun 10th 2007
     permalink
    This'll require javascript. I'm partial to two javascript libraries: event:Selectors and Prototype. With these, it's pretty easy. If you look at the event:Selectors page, you'll see examples, and then I'd use Prototype's addClassName, removeClassName, and hasClassName functions to toggle the classes. To actually find the div the form elements are in, you could either get the parentNode of those elements, or give the div an id.
  1.  permalink
    To know more about freelancing

    experiences and new freelance works visit

    http://tinyurl.com/yr4k7n

    http://www.getafreelancer.com/affiliates/L

    antis/
Add your comments
    Username Password
  • Format comments as (Help)