Remove Link from anchor tag
-
Monday, July 16, 2012 6:34 PM
hi
I want to remove link from anchor tag using css & result should be plain simple text. pls help as soon as possible
Thanks in advance
All Replies
-
Tuesday, July 17, 2012 12:39 AM
If it's a pre-existing anchor tag you will need to use jQuery to remove the href attribute. You can do this with the following code
$(document).ready(function(){ $('a.yourAnchorTagClass').removeAttr('href'); });This will remove the href attribute from <a href="#" class="yourAnchorTagClass">your text here</a>
If this is a custom anchor tag then consider using the <span> tag instead. i.e. <span>your text here</span> instead of <a href="">your text here</a>
-
Tuesday, July 17, 2012 5:54 AM
thanks for reply. but in following code anchor tag doesn't have class. it's located inside the span tag & span has class so how i will remove a link from anchor tag using css in sharepoint.
<span class="ms-imnSpan"> <a onclick="GoToLink(this);return false;" href="/sites/CPFDO/DEVLN/Test_ConRoomBook/_layouts/userdisp.aspx?ID=283">Wecome</a> </span>
thanks :)
- Edited by SurekhaP Tuesday, July 17, 2012 6:12 AM
-
Tuesday, July 17, 2012 6:56 AM
$(document).ready(function(){ $('span.ms-imnSpan a').removeAttr('href'); });
(Or)
$(document).ready(function(){ $('span.ms-imnSpan a').click(function() { return false; }); });
Use any one of the above code.
Puli Bala
- Marked As Answer by Jinchun ChenMicrosoft Employee, Moderator Monday, August 06, 2012 6:58 AM
-
Tuesday, July 17, 2012 7:32 AM
Is any one have idea ? how to attach jquery code to sharepoint designer 2010 page through webpart without using masterpage?
Thanks
- Edited by SurekhaP Tuesday, July 17, 2012 8:39 AM
-
Tuesday, July 17, 2012 8:42 AM
thanks Pulithevan
but pls will u provide css code for that
thanks
- Edited by SurekhaP Tuesday, July 17, 2012 8:45 AM
-
Monday, August 06, 2012 7:00 AMModerator
Hi SurekhaP,
In order to include JQuery into a SharePoint page without modifying the master page, we can use Content Edit Web Part page. For the detailed steps, please see:
http://www.sharepointjoel.com/Lists/Posts/Post.aspx?ID=178CSS is used for changing the style for a HTML element, it won't be able to remove the hyper link.
Thanks,
Jinchun ChenJinchun Chen
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff AT microsoft.com(Please replace AT with @)

