How to edit this 'edit image' and redirect ?

Hi All,

I've created a list, if i click the edit image it will open that item in editable mode. But I need to replace with another image and also redirect to another page. If that image once clicked, then it should seen no more. How to do this?

Thanks in advance!

December 11th, 2013 4:35pm

Hi,

Assume the edit column is the second column, you can use the code below.

<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>

<script type="text/javascript">

_spBodyOnLoadFunctionNames.push("ready");

// Make sure the SharePoint script file 'sp.js' is loaded before your

// code runs.

function ready()

{

                //select an item in this list: here is the first row of this list

                var $tr1=$("tbody").find("tr:first");

                //select a column in this list: here is the second column(Edit field) of the first row

                var $td4=$tr1.find("td:first").next().next().next();

               

                var $a=$td4.find("a");

                var $img=$a.find("img");

               

                //change the href and icon of the "Edit" field here

                $a.attr({ onclick : "" , href : "http://www.bing.com" });

                $img.attr({ src : "/_layouts/15/images/siteIcon.png?rev=24" , alt : "bing" });

                                                                                               

}

</script>

If you want to redirect to a page which is no related to the item, you can simply add a button on this page. If you want to redirect to the page which is related to this item, you can use client object model to retrieve the value of the current item and generate the url.

For your reference:

jQuery API:

http://api.jquery.com/find/

http://api.jquery.com/next/

Thanks.

Free Windows Admin Tool Kit Click here and download it now
December 13th, 2013 6:22am

Hi Tracy,

Thanks for your reply, Actually I am using Infopath custom list form. Can you please elaborate how to apply your solution.

Thanks in advance once again!

December 14th, 2013 3:37am

Hi,

Click Edit page and insert a content editor web part on this page. Click the Edit Source button and pase the code in it.

Thanks.

Free Windows Admin Tool Kit Click here and download it now
December 16th, 2013 3:29am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics