my dog learned polymorphism*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 60800
    
  65

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: 60800
    
  65

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: 60800
    
  65

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: 60800
    
  65

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: anchor tag , click and livequery
 
Similar Threads
Anchor tag calling Javascript function
When does livequery execute code?
livequery and trigger
jQuery live() custom events
anchor tag and window.event.srcElement dont work