drsanupmoideen
08-10-2010, 09:08 PM
Hello Everybody, For my site, I would like to remove the href tags from all links created by users. So i added the following code to the header session of my site.
<script type="text/javascript">
jQuery(document).ready(function($) {
$("a").filter(function() {
return this.hostname && this.hostname !== location.hostname;
}).addClass('external').attr("target", "_blank").removeAttr('href');
});
</script>
Its working fine, except that, it also removes the links to my subdomains. Can anybody please help me? I just want to remove the href tag only from contents inside a particular div "pagebody".
Thankyou all :)
<script type="text/javascript">
jQuery(document).ready(function($) {
$("a").filter(function() {
return this.hostname && this.hostname !== location.hostname;
}).addClass('external').attr("target", "_blank").removeAttr('href');
});
</script>
Its working fine, except that, it also removes the links to my subdomains. Can anybody please help me? I just want to remove the href tag only from contents inside a particular div "pagebody".
Thankyou all :)