jackjohnson44
asked on
jquery can't select element
I am trying to hide a button on a SharePoint form using jquery. For some reason, I just can't select the element. I am trying this in firebug's console window so I don't have to keep deploying.
I really want to be able to point to the delete icon, but the whole li would work too.
I tried these
$('li #Ribbon\\.DocLibListForm\\ .Edit\\.Ac tions').cs s('border' , '1px solid red');
$('Ribbon.DocLibListForm.E dit.Action s').css('b order', '1px solid red');
I am setting the border just to make sure I have the object, but I have also tried hide(), and html(). The issue is the selector.
<li unselectable="on" id="Ribbon.DocLibListForm. Edit.Actio ns" class="ms-cui-group"><span unselectable="on" class="ms-cui-groupContain er"><span unselectable="on" class="ms-cui-groupBody">< span unselectable="on" id="Ribbon.DocLibListForm. Edit.Actio ns-LargeLa rge" class="ms-cui-layout"><spa n unselectable="on" id="Ribbon.DocLibListForm. Edit.Actio ns-LargeLa rge-0" class="ms-cui-section"><sp an unselectable="on" id="Ribbon.DocLibListForm. Edit.Actio ns-LargeLa rge-0-0" class="ms-cui-row-onerow"> <a unselectable="on" role="button" aria-describedby="Ribbon.D ocLibListF orm.Edit.A ctions.Del eteItem_To olTip" mscui:controltype="Button" href="javascript:;" onclick="return false;" id="Ribbon.DocLibListForm. Edit.Actio ns.DeleteI tem-Large" class="ms-cui-ctl-large">< span unselectable="on" class="ms-cui-ctl-largeIco nContainer "><span unselectable="on" class=" ms-cui-img-32by32 ms-cui-img-cont-float ms-cui-imageDisabled"><img src="/_layouts/1033/images /formatmap 32x32.png" unselectable="on" style="top: -128px;left: -128px;" class=""></span></span><sp an unselectable="on" class="ms-cui-ctl-largelab el">Delete <br>Item</ span></a>< /span></sp an></span> </span><sp an title="Actions" unselectable="on" class="ms-cui-groupTitle"> Actions</s pan></span ><span unselectable="on" class="ms-cui-groupSeparat or"></span ></li>
I really want to be able to point to the delete icon, but the whole li would work too.
I tried these
$('li #Ribbon\\.DocLibListForm\\
$('Ribbon.DocLibListForm.E
I am setting the border just to make sure I have the object, but I have also tried hide(), and html(). The issue is the selector.
<li unselectable="on" id="Ribbon.DocLibListForm.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You may be missing jQuery api in the site.
Here is demo where I've embedded it:
http://jsfiddle.net/GN2Tz/1/
Just add this code to the site:
Here is demo where I've embedded it:
http://jsfiddle.net/GN2Tz/1/
Just add this code to the site:
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(function() {
$('li#Ribbon\\.DocLibListForm\\.Edit\\.Actions').css('border', '1px solid red');
});
</script>
ASKER
From all appearances it should be working.
Any advice?