[jQuery] Re: Using jQuery to completely separate HTML from Javascript

2009-07-15 Thread FrenchiInLA
how about # # # $('.foo').click(function(){ var par = $(this).attr('name'); // do whatever you need with name attribution }); Thierry-32 wrote: > > > Hi, > > I am trying to remove every Javascript reference from my HTML data > (except the inclusion headers of course). > I would like

[jQuery] Re: Using jQuery to completely separate HTML from Javascript

2009-07-15 Thread Brett Ritter
On Mon, Jul 13, 2009 at 10:18 AM, Thierry wrote: > $(document).ready( >  function() { >    $("a.foo").click(foo()); >  } > ) This is probably not quite what you desire, as it will call foo() immediately, not on click. use $("a.foo").click(foo);// <--Note 'foo', reference to function, not foo(),

[jQuery] Re: Using jQuery to completely separate HTML from Javascript

2009-07-13 Thread James
Something like this could achieve what you want: $("a.link").click(function() { var id = this.id.split('-')[1]; // -> 1, 2, or 3 foo(id); return false; // prevents follow through of link }); On a side note, if you want to do a click and directly call a function without passi