View Single Post
Old 02-08-2013, 08:05 AM   PM User | #2
LearningCoder
Regular Coder

 
LearningCoder's Avatar
 
Join Date: Jan 2011
Location: The Pleiades
Posts: 849
Thanks: 67
Thanked 28 Times in 28 Posts
LearningCoder is an unknown quantity at this point
Hey dude,

You need a way to target the <li> but when you click on either an input or textarea. You wouldn't set the :focus psuedo on the <li> but rather on the inputs and textarea. There's only one way I would know how to achieve this.

Are you familiar with jQuery at all?

I just wrote this for you and it's got the exact same functionality.
Code:
$(function(){
    $('input,textarea').focus(function(){
        $(this).closest('li').css("background", "red");
    });
    
    $('input,textarea').focusout(function(){
        $(this).closest('li').css("background", "none");
    });
    
});
Maybe it could be done with just CSS though I am not sure.

I hope this helps you.

Kind regards,

LC.

Last edited by LearningCoder; 02-08-2013 at 08:10 AM..
LearningCoder is offline   Reply With Quote