Many thanks Karl, I never would have got there without help.
On Dec 10, 5:10 pm, Karl Swedberg [EMAIL PROTECTED] wrote:
Hi Kris,
The problem is that $(this) is referencing something other than the
link at that point -- either some enclosing method or the window
object. You can get
Okay the only issue I'm facing now and its not strictly a JQuery one,
its more an IE one...
HREF's like 'images/trucks.jpg' should be prefixed with 'cms/' giving
'cms/images/trucks.jpg'.
Firefox and Safari are okay, I get URLs like:
http://www.mydomain.com/inprog/cvs/cms/images/trucks.jpg
But
Own workaround:
if(document.domain=='localhost') { var root_url = 'http://localhost/
project/'; } else { var root_url = 'http://www.mydomain.com/inprog/
project'; }
$(#content_main a:not(.external)).attr('href', function() {
orig_url = $(this).attr('href');
Honestly, it might be easier to just overload the links onclick
events, instead of worrying about doing the appendation to
everything.
$(#content_main a).click(function(){
window.location = 'cms/' + $(this).attr('href');
});
On Dec 11, 9:11 am, Kris [EMAIL PROTECTED] wrote:
Okay the only
Hi Kris,
jQuery should be normalizing the href attribute when you
use .attr('href'). Not sure why it's not working for you.
In any case, you should be able to do this a bit more easily:
var path_prefix = '/cms/';
$('#content_main a:not(.external)').attr('href', function() {
return
Hi Kris,
The problem is that $(this) is referencing something other than the
link at that point -- either some enclosing method or the window
object. You can get around this by using a callback function as the
second argument of .attr() :
$(#content_main a).attr('href', function() {
6 matches
Mail list logo