From pmusers
Jump to: navigation, search

Add link to image

To add a link to an image, add similar JavaScript code to the Dynaform:

var imageId = "myimage"; //set to ID of image field
var targetUrl = ""; //set to the target web site

var imgCode = '<a href="'+targetUrl+'" target="_blank" >' + 
    $("#"+imageId).find("img").prop("outerHTML") + '</a>';

Then, when the user clicks on the image in the Dynaform, a new tab or window will open with the target web site.