[jQuery] Re: Translate standard HREF's into JavaScript expressions -- string manipulation help..

2008-10-14 Thread jsw_nz
Hi Michael Paul Thanks for your replies - both expressions work ! (plus another I worked on prior to your responses). Just have to say thanks for the great jquery community support offerred here While I have your attention - had another question to ask Since I am translating the standard

[jQuery] Re: Translate standard HREF's into JavaScript expressions -- string manipulation help..

2008-10-14 Thread Michael Geary
I like Paul's solution better than mine. It's cleaner to attach an event handler rather than rewrite the href attribute. Does your page have a large number of a tags, or just a few? If there are a lot of them and the jQuery code slows the page load down, you could use event delegation to fix

[jQuery] Re: Translate standard HREF's into JavaScript expressions -- string manipulation help..

2008-10-14 Thread jsw_nz
Hi Michael, Thanks for the pointers - no -- the treatment of rel attribute on a tags is limited - so I guess it will be OK - i run the code on Ajax success event - - again thanks much !

[jQuery] Re: Translate standard HREF's into JavaScript expressions -- string manipulation help..

2008-10-13 Thread Paul Mills
Hi, Rather than replace the href in the source code you could add a click handler to call your JavaScript function. A bit like this: $(function(){ $('a[rel=paginate]').click(function(){ ajax_getPage($(this).attr(href).split(=)[1]); return false; }); }); Paul On Oct 12, 10:56 pm,

[jQuery] Re: Translate standard HREF's into JavaScript expressions -- string manipulation help..

2008-10-12 Thread Michael Geary
I think it would go something like this (thoroughly untested): $(function() { $('a[rel=paginate]').each( function() { this.href = this.href.replace( /^.*aid=(.+)$/, javascript:ajax_getPage('$1') ); }); }); -Mike