[jQuery] How do get the ID of an element that has been clicked ?

2009-04-10 Thread thought
Hi all. This might be more of a javascript problem rather than a jquery problem, but I'm also wondering if there is a 'jquery way' of solving it. Given this code: DIV id=div_one/DIV DIV id=div_two/DIV DIV id=div_three/DIV DIV id=div_four/DIV Lets say that the user is invited to click one one

[jQuery] Re: How do get the ID of an element that has been clicked ?

2009-04-10 Thread thought
Thanks for the swift replies. I've got a lot to learn about javascript, and at this point, adapting charlies code, I get a strange effect that I didn't anticipate, and don't understand. $('.thumbnail').live(click, function(){ $(div[id^='thumbnail']).click(function() {

[jQuery] Re: How do get the ID of an element that has been clicked ?

2009-04-10 Thread thought
and comparing it to the selector, in this case, the thumbnail class.  I personally prefer to use live handlers for content that is added and removed dynamically since it is easier to manage. On Apr 10, 9:30 pm, thought thou...@orcon.net.nz wrote: Thanks for the swift replies. I've got a lot

[jQuery] Re: How do get the ID of an element that has been clicked ?

2009-04-10 Thread thought
('id') ); }); $('.thumbnail').click(function() {         alert( $(this).attr('id') ); }); Whether you use $('.thumbnail') or $(div[id^='thumbnail']) though depends on your markup. On Fri, Apr 10, 2009 at 10:00 PM, thought thou...@orcon.net.nz wrote: So then this behaviour is working

[jQuery] validate - can a call a function only if the form is validated?

2008-12-03 Thread thought
Hi. I'm using jquery.validate for a contact form. I'd like to know how to add behaviours conditional to the success of the form validation. Like, if the form has been validated, I'd like to go ahead with some DOM manipulations or a redirect. Is this possible? Thanks