Search code examples
javascriptphpjquerycolorbox

Pass selection from Colorbox to parent


I am using a Colorbox modal for a image selection in one of my forms. Is there a way to dynamically pass the image selection outside of the Colorbox and then close the Colorbox?

I have been searching here on StackOverflow but I cant find anyone else trying to achieve the same thing.


Solution

  • I figured it out. After adding Jquery to the file loaded in Colorbox I was able to use window.parent.$("#select").after('<input type="hidden" name="image" value="' + img + '">');