I am having library in SharePoiint 2010 and also Document Library. I have placed a view of the document library in a web part. There is a link to “add new document” that I want change with JQuery;
$("#idHomePageNewAnnouncement").attr('href','google.com');
and it works if I check it afterwards in a alert()
alert($('#idHomePageNewAnnouncement').attr('href')); // gives google.com
but if I hoover it or open it in a new window a prefix is added with the site URL; it will give http:// sitename/webname/subsite/google.com.
How can I get rid of this prefix in the link?
I don’t have access to SharePoint Designer or Visual Studio in this project.
hrefattributes are either relative (not starting with “http://” or similar) or absolute. Since your link is relative, the browser is going to look for a file called “google.com” in the current directory. Try this instead: