/ Favour

Setting base path dynamically through jquery/javascript?

Is there a way to dynamically alter the content inside the tag?, throught jquery or javascript?

I am not using php or any server side script. I am using backbone.js & hence i have a .html file.

I have come to a situation where i would need to type in base path.


I have searched around & i havent received anywhere.

Probably this is not possible at all, yet just wanted to check it here in stackoverflow.

Using jQuery. Here is jsFiddle I’ve made [http://jsfiddle.net/uQVeN/](http://jsfiddle.net/uQVeN/)



$(document).ready(function(){ $('#valueBefore').text( $('base').attr('href') ); $('base').attr('href','kjhsgdkjahgdjkahgdf'); $('#valueAfter').text( $('base').attr('href') ); });

Will produce:

www.google.com kjhsgdkjahgdjkahgdf