Skip to content

Instantly share code, notes, and snippets.

View ryanfitton's full-sized avatar

Ryan Fitton ryanfitton

View GitHub Profile
<script type='text/javascript'>
var file_frame;
jQuery('.upload_image_button').live('click', function( event ){ // '.upload_image_button' is the ID of my button that opens the Media window
formfield = jQuery(this).prev().attr('name'); // Needed for the script to send the URL to the appropriate text box
event.preventDefault();
if ( file_frame ) {
file_frame.open();
<div style='clear:both;margin-bottom:10px;overflow:auto;'>
<label>Image 1: </label>
<input name='image_1_port' id='image_1_port' style='width:200px' />
<input id='_btn' class='upload_image_button' type='button' value='Choose Image 1' />
</div>
<div style='clear:both;margin-bottom:10px;overflow:auto;'>
<label>Image 2: </label>
<input name='image_2_port' id='image_2_port' style='width:200px' />
<input id='_btn' class='upload_image_button' type='button' value='Choose Image 2' />
<script type='text/javascript'>
var file_frame;
jQuery('.upload_image_button').live('click', function( event ){ // '.upload_image_button' is the ID of my button that opens the Media window
formfield = jQuery(this).prev().attr('name'); // Needed for the script to send the URL to the appropriate text box
event.preventDefault();
if ( file_frame ) {
file_frame.open();