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.
Like
<base href="www.google.com" />
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/
HTML:
<base href="www.google.com" /><div id="valueBefore"></div><div id="valueAfter"></div>
JS:
$(document).ready(function(){ $('#valueBefore').text( $('base').attr('href') ); $('base').attr('href','kjhsgdkjahgdjkahgdf'); $('#valueAfter').text( $('base').attr('href') );});
Will produce:
www.google.comkjhsgdkjahgdjkahgdf
No comments:
Post a Comment