开发者

How to apply jQuery to a SharePoint grouped list view

I'm trying to change the SharePoint list item "Edit" icon to a new image on a SharePoint 2007 site. I've got it working fine by applying some jQuery to the master page. The problem i'm having is, any list view that is configured to be "Grouped", doesn't get the new Icon because the HTML isn't rendered on document.ready. The HTML gets added once you expand the groupings after page load.

My question is, how do you apply jQuery/Javascript to the html that gets rendered after the page load?

Here's the simple code i'm using.

<script language="javascript">   
    $(document).ready(function()开发者_运维百科 {
        $("img[src*='edititem.gif']").attr("src","<URL to New Img>").attr("title","Comment");
    });
</script>


You can use livequery to do this.

It would look something like this.

$(document).ready(function() {

  $("img[src*='edititem.gif']").livequery(function(){
    $(this).attr("src","").attr("title","Comment");
  });

});


Try _spBodyOnLoadFunctionNames:

<script language="javascript">   
    _spBodyOnLoadFunctionNames.push("FunctionName");   
    function FunctionName()   
    {   
        $("img[src*='edititem.gif']").attr("src","<URL to New Img>").attr("title","Comment"); 
    }   
</script> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜