Re: [jQuery] how to get href value

2010-01-23 Thread Andrei Eftimie
$(document).ready(function() {        $(a).click(function(event) {                alert( You clicked a link to + this.href );                return false;        }); }); This method is very slow. Try using event delegation: $(document).ready(function() {

[jQuery] how to get href value

2010-01-19 Thread adi sembiring
I'm trying to get href value from anchor tag. code $(document).ready(function() { $(a).click(function(event) { alert(As you can see, the link no longer took you to jquery.com); //$(a).html.href; event.preventDefault(); }); }); a

Re: [jQuery] how to get href value

2010-01-19 Thread Matt Quackenbush
$(a).attr(href);

Re: [jQuery] how to get href value

2010-01-19 Thread Michael Geary
But that would give you the href for the first A element in the document, not necessarily the one you clicked. Going back to the OP's code, this.href would be the easiest way to get it: $(document).ready(function() { $(a).click(function(event) { alert( You clicked

Re: [jQuery] how to get href value

2010-01-19 Thread adi sembiring
Got it ..., thanks all On Wed, Jan 20, 2010 at 1:22 PM, Michael Geary m...@mg.to wrote: But that would give you the href for the first A element in the document, not necessarily the one you clicked. Going back to the OP's code, this.href would be the easiest way to get it: