aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes anchor tag , click and livequery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "anchor tag , click and livequery" Watch "anchor tag , click and livequery" New topic
Author

anchor tag , click and livequery

Naveen puttu
Ranch Hand

Joined: Sep 15, 2009
Posts: 88
Hi folks ,

I have an anchor which looks like this



im trying to do something when one clicks on this anchor tag


But when i click on the anchor tag . i dont get an alert coz the control isnt going inside that livequery function

this is annoying . what am i doing wrong

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
coz is not a word UseRealWords

Your selector is saying look for an element with the tag "trigger" and find any element inside that that is the tag "a"

Your selector should just be #trigger

Eric
Naveen puttu
Ranch Hand

Joined: Sep 15, 2009
Posts: 88
Eric ,

#trigger doesnt work for me

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

ItDoesntWorkIsUseless

There is no reason it should not work if you are accurately showing your markup.

What version of jQuery are you using?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Naveen puttu
Ranch Hand

Joined: Sep 15, 2009
Posts: 88
1.2.6 is the jquery version
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

If you have a unique element with an id value, that value will get selected by $('#elementId'). Are you sure that your markup is valid? That the script is being executed?
Naveen puttu
Ranch Hand

Joined: Sep 15, 2009
Posts: 88
i dont know what exactly do you mean by

Are you sure that your markup is valid? That the script is being executed?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

Is your HTML valid? If you have bad HTML, multiple ids of the same value, or other markup errors, nothing will work right.

Also, if the script doesn't execute, it can't do anything.
Naveen puttu
Ranch Hand

Joined: Sep 15, 2009
Posts: 88
Bear,

Im positive that the anchor tag has a unique id

lemme explain what iam trying to achieve

I have a table with th and td tags

i have an anchor tag against one of these th tags . i want to do something when the link is clicked .

By the way what would stop the script from being executed

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

Naveen puttu wrote:Im positive that the anchor tag has a unique id

Then there is no reason that the selector will not work.

i have an anchor tag against one of these th tags . i want to do something when the link is clicked .

Why are you using livequery for this?

By the way what would stop the script from being executed

Bad markup. Other script errors. Etc...

Are you using Firebug to help debug this?
Naveen puttu
Ranch Hand

Joined: Sep 15, 2009
Posts: 88
im using firebug for debugging with breakpoint

firstly , no errors reported by firebug when the page loads
 
Consider Paul's rocket mass heater.
 
subject: anchor tag , click and livequery