1. use the ID attribute, DIVs don't have a "name" attribute
2. you can do that with CSS only as below:

#test:hover { border:2px solid blue }
<div id="test">something</div>

an IE safe version:
#test:hover div { border:2px solid blue }
<a href="#" id="test"><div>something</div></a>

with jQuery:
$('#test').hover(
 function(){ $(this).css('border','2px solid blue') },
 function(){ $(this).css('border','0') }
);
<div id="test">something</div>

Also make sure you are putting everything inside the ready() function
so that it only executes after the elements exist:

$(document).ready(function(){

   // your code here
   $('div').hover(...)

});

The jQuery documentation at http://docs.jquery.com/ should help you
out too.

cheers,
- ricardo


On Nov 22, 11:46 am, Johan Fredriksson <[EMAIL PROTECTED]>
wrote:
> Hi!
>
> I just started to play with jQuery and have loads to learn but I try
> to get i div to highlight it's borders when i hover with the mouse
> over it ( like 2px and dark blue).
>
> But, no matter what I try, it will not highlight itself! Div should be
> selected by name and not by class name.
>
> Any help, small or big is very much appreciated!
>
> Cheers
> Johan

Reply via email to