119
rated 0 times
[
122]
[
3]
/ answers: 1 / hits: 16891
/ 14 Years ago, sun, march 6, 2011, 12:00:00
HTML:
<a href=/>1</a> // link to http://site.com
<a href=/section/page/>2/a> // link to http://site.com/section/page/
<a href=http://site.com/>3</a>
<a href=../gallery/1/>4</a> // link to http://site.com/gallery/1/
JS:
$(a).live('click', function(){
var url = $(this).attr(href);
//do something
});
How to convert relative path (var url
) to absolute by jQuery?
Script should do nothing, if it is already an absolute path.
Thanks.
More From » jquery