Link to home
Create AccountLog in
Avatar of jackjohnson44
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\\.Actions').css('border', '1px solid red');
$('Ribbon.DocLibListForm.Edit.Actions').css('border', '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.Actions" class="ms-cui-group"><span unselectable="on" class="ms-cui-groupContainer"><span unselectable="on" class="ms-cui-groupBody"><span unselectable="on" id="Ribbon.DocLibListForm.Edit.Actions-LargeLarge" class="ms-cui-layout"><span unselectable="on" id="Ribbon.DocLibListForm.Edit.Actions-LargeLarge-0" class="ms-cui-section"><span unselectable="on" id="Ribbon.DocLibListForm.Edit.Actions-LargeLarge-0-0" class="ms-cui-row-onerow"><a unselectable="on" role="button" aria-describedby="Ribbon.DocLibListForm.Edit.Actions.DeleteItem_ToolTip" mscui:controltype="Button" href="javascript:;" onclick="return false;" id="Ribbon.DocLibListForm.Edit.Actions.DeleteItem-Large" class="ms-cui-ctl-large"><span unselectable="on" class="ms-cui-ctl-largeIconContainer"><span unselectable="on" class=" ms-cui-img-32by32 ms-cui-img-cont-float ms-cui-imageDisabled"><img src="/_layouts/1033/images/formatmap32x32.png" unselectable="on" style="top: -128px;left: -128px;" class=""></span></span><span unselectable="on" class="ms-cui-ctl-largelabel">Delete<br>Item</span></a></span></span></span></span><span title="Actions" unselectable="on" class="ms-cui-groupTitle">Actions</span></span><span unselectable="on" class="ms-cui-groupSeparator"></span></li>
ASKER CERTIFIED SOLUTION
Avatar of lightspeedvt
lightspeedvt

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of jackjohnson44
jackjohnson44

ASKER

Thanks.  I can see in your demo that it is working, but it won't work on my site, which is a SharePoint site that uses a modal window.

From all appearances it should be working.

Any advice?
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:
<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>

Open in new window