Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-09-2009, 04:22 PM   PM User | #1
sybil6
Regular Coder

 
Join Date: Jul 2006
Posts: 399
Thanks: 33
Thanked 7 Times in 7 Posts
sybil6 can only hope to improve
how can i do this selection in jquery

i want to select the div with id headerimg, so this is:
Code:
     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
sybil6 is offline   Reply With Quote
Old 12-09-2009, 04:31 PM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
And the search_form table is inside the headerimg div I suppose?
__________________
Fumigator is offline   Reply With Quote
Old 12-09-2009, 10:22 PM   PM User | #3
sybil6
Regular Coder

 
Join Date: Jul 2006
Posts: 399
Thanks: 33
Thanked 7 Times in 7 Posts
sybil6 can only hope to improve
yes it is
sybil6 is offline   Reply With Quote
Old 12-10-2009, 09:25 AM   PM User | #4
Iszak
Regular Coder

 
Iszak's Avatar
 
Join Date: Jun 2007
Location: Perth, Western Australia
Posts: 332
Thanks: 2
Thanked 58 Times in 57 Posts
Iszak is an unknown quantity at this point
Try the following code;
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
Iszak is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:56 AM.


Advertisement
Log in to turn off these ads.