...

View Full Version : how can i do this selection in jquery



sybil6
12-09-2009, 04:22 PM
i want to select the div with id headerimg, so this is:

jQuery("div#headerimg").click(function () {

document.location="http://google.com/";
});

but at the same time i want to omit a table with id=search_form from the selection.
thanks

Fumigator
12-09-2009, 04:31 PM
And the search_form table is inside the headerimg div I suppose?

sybil6
12-09-2009, 10:22 PM
yes it is

Iszak
12-10-2009, 09:25 AM
Try the following code;


$('#headerimg').click(function(event){
var $target = $(event.target);

// Stop it from executing for search form and children
if ($target.is('#search_form') == true || $target.parents('#search_form').length > 0)
{
return;
}
});

And yes I know I could cut down the code, but I chose not to for readability :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum