Luis Valencia
Luis Valencia

Reputation: 33988

Hide span with jquery is not working

I have a sharepoint webpart that shows some information from some lists, the lists are security trimmed, so if the user does not have permission to that list, it will show access denied. Which is fine.

I want to hide that part of the page.

I found how to solve it here: http://www.timferro.com/wordpress/archives/227

This is the code I have:

<script src="/_layouts/Scripts/jquery1.8.1.min.js"></script><script language="javascript">


$("span:contains('Error')").hide();
$("div:contains('Access denied'):not(:has(div))").hide();</script>

And this is the screenshot that shows what I need to hide.

1

Better pic here

enter image description here

Update: when I hide it, now sharepoint its showing me a blue line that I want to get rid off, but If I hide the blue line only, then a strange space will be between webparts, I think the best is to hide that TD that contains the rest of the things? How can I hide that?

Please see new screeenshot

enter image description here

Upvotes: 0

Views: 1192

Answers (2)

Andy
Andy

Reputation: 30135

looks like you forgot to put it inside the jQuery ready function:

$(function(){
    $("span:contains('Error')").hide();
    $("div:contains('Access denied'):not(:has(div))").hide();
});

Upvotes: 2

Selvakumar Arumugam
Selvakumar Arumugam

Reputation: 79830

Try below,

$(".UserGeneric span.ms-bold:contains('Error')").hide();

or If you want to hide the whole error then

$(".UserGeneric span.ms-bold:contains('Error')").parent().hide();

Upvotes: 0

Related Questions