Created
March 8, 2012 01:34
-
-
Save justinwhall/1997876 to your computer and use it in GitHub Desktop.
jQuery: WordPress | Uploader for theme options page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function() { | |
jQuery('.st_upload_button').click(function() { | |
/* formfield = jQuery('#st_upload').attr('name'); */ | |
targetfield = jQuery(this).prev('.upload-url'); | |
tb_show('', 'media-upload.php?type=image&TB_iframe=true'); | |
return false; | |
}); | |
window.send_to_editor = function(html) { | |
imgurl = jQuery('img',html).attr('src'); | |
jQuery(targetfield).val(imgurl); | |
tb_remove(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment