Re: [jQuery] How to gain reference to hyperlink that is clicked

2010-01-06 Thread CoffeeAddict

Ah, (this), I'm a newbie to that in jQuery.

Thanks.


Charlie Griefer wrote:
 
 input type=button id=addButton1 class=myButton /
 input type=button id=addButton2 class=myButton /
 
 script type=text/javascript
  $(document).ready(function() {
   $('.myButton').click(function() {
alert($(this).attr('id'));
// alert(this.id) -- should also work
   }
  });
 /script
 
 Notice that I added a class=myButton to each button element, and set the
 listener for $('.myButton').click(), which listens for a click event on
 any
 element that matches that selector.
 
 Within the function triggered by the click event, $(this) or this are both
 references to the element that triggered the click.
 
 On Tue, Jan 5, 2010 at 12:35 PM, CoffeeAddict dschin...@gmail.com wrote:
 

 I understand that I can use the .click() method on a hyperlink element.
  But
 how do I know which element was clicked?  First I have to gain reference
 to
 the hyperlink's ID.

 So lets say I have a page of hyperlinks like this in view source:

 ...someurl  somebutton
 ...someurl  somebutton
 ...someurl  somebutton
 ...someurl  somebutton

 when a user clicks addButton1, how do I know it's addButton1 that was
 referenced so that I can now apply a .click() event on it?
 --
 View this message in context:
 http://old.nabble.com/How-to-gain-reference-to-hyperlink-that-is-clicked-tp27026713s27240p27026713.html
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.


 
 
 -- 
 Charlie Griefer
 http://charlie.griefer.com/
 
 I have failed as much as I have succeeded. But I love my life. I love my
 wife. And I wish you my kind of success.
 
 

-- 
View this message in context: 
http://old.nabble.com/How-to-gain-reference-to-hyperlink-that-is-clicked-tp27026713s27240p27046016.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] How to gain reference to hyperlink that is clicked

2010-01-05 Thread CoffeeAddict

I understand that I can use the .click() method on a hyperlink element.  But
how do I know which element was clicked?  First I have to gain reference to
the hyperlink's ID.

So lets say I have a page of hyperlinks like this in view source:

...someurl  somebutton  
...someurl  somebutton  
...someurl  somebutton  
...someurl  somebutton  

when a user clicks addButton1, how do I know it's addButton1 that was
referenced so that I can now apply a .click() event on it?
-- 
View this message in context: 
http://old.nabble.com/How-to-gain-reference-to-hyperlink-that-is-clicked-tp27026713s27240p27026713.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Don't use onclick

2009-10-12 Thread CoffeeAddict


Am I wrong to say you should never use onclick in an element as this would be
contrary to the purpose of using jQuery which means onclick would totally
bind mark-up to javascript?  So it would not be unobtrusive in that case.
-- 
View this message in context: 
http://www.nabble.com/Don%27t-use-onclick-tp25865558s27240p25865558.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Check value client side

2009-10-06 Thread CoffeeAddict


I want to check a value client side in jQuery.  The bool will tell me if the
user is logged in or not.  Is the only/best way to do this in ASP.NET
specifically is with a hidden field?
-- 
View this message in context: 
http://www.nabble.com/Check-value-client-side-tp25770768s27240p25770768.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Access a certain Button

2009-10-06 Thread CoffeeAddict


I'm trying to get reference to a certain button on the DOM.  I tried this:

$('button#btnRegister').click(function() {

where button has the ID of btnRegister.

is this right?
-- 
View this message in context: 
http://www.nabble.com/Access-a-certain-Button-tp25771231s27240p25771231.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] $ not recognized even though jQuery library referenced

2009-10-03 Thread CoffeeAddict


I my ASP.NET master page I've got the following:

head id=Head1 runat=server
title id=Title runat=server /title
link href=~/Main.css rel=stylesheet type=text/css /
 
!-- jQuery Image Mouseover --
script src=../js/jQuery/jquery-1.3.2.min.js
type=text/javascript/script
script src=../js/jQuery/ImageMouseover/thumbhover.js
type=text/javascript/script
script type=text/javascript

$(function() {
$(img[src*='_s.jpg']).thumbPopup({
imgSmallFlag: _s,
imgLargeFlag: _l
});
});


/script
/head

and yes, the paths are right.  I still get this error in firebug no matter
what:

$ is not defined
-- 
View this message in context: 
http://www.nabble.com/%24-not-recognized-even-though-jQuery-library-referenced-tp25734586s27240p25734586.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.