JQuery add .hover() to every anchor except those that already have effect?

Many ways to do this, some of which are. First $('a'). Not('#test a, #test2 a'); Second var divs_to_test = $('#test').

Add('#test2'); $('a'). Filter(function(){ return! $(this).parent().

Is(divs_to_test); }).

You can write $('a'). Not($('#test a, #test2 a')) To select all s that are not in those elements.

Uncaught Syntax error, unrecognized expression: (#test, #test2). – Interstellar_Coder Nov 13 at 17:36 @Interstellar_Coder: Fixed. – SLaks Nov 13 at 17:37 I would set your answer as accepted but interstellar_coder gave two ways & his similar way to yours is with less chars > therefore faster (for loading).

– Ron Nov 13 at 17:45.

The easiest way I found for this is the somewhat less-than-concise: $('a'). Filter( function() { if (!$(this). Closest('divid^="test"').

Length) { return this; } }). Hover( function(){ $(this). Css('background-color','red'); }, function(){ $(this).

Css('background-color','white'); }); JS Fiddle demo.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions